无法摆脱“物理连接不可用".例外 [英] Cannot get rid of "physical connection is not usable" exception

查看:447
本文介绍了无法摆脱“物理连接不可用".例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开枪自杀.现在花了几个星期试图解决这个问题.我们有一个ASP.NET MVC 4 Web应用程序,该应用程序使用SQL Server 2012和Entity Framework作为ORM和Unity for IoC. Web应用程序托管在Amazon EC2上.我开始收到物理连接不可用"异常.一天发生几次.我搜索了许多文章和论坛,并尝试了所有可能的建议:

I am about to shoot myself. Spent few weeks now trying to solve this issue. We have an ASP.NET MVC 4 web app that uses SQL Server 2012 and Entity Framework as ORM and Unity for IoC. Web app is hosted on Amazon EC2. I started getting "Physical connection is not usable" exception. It happens few times a day. I searched many articles and forums and tried all the possible suggestions:

  • 试图从连接字符串"Polling = False"中删除池
  • 尝试限制池大小和连接寿命
  • 尝试将Unity的LifetimeManager更改为HierarchicalLifetimeManager,PerRequestLifetimeManager.还确保在请求结束后释放实体上下文
  • 删除了所有TransactionScope引用

发生异常时,还原应用程序的唯一方法是重新启动服务器,这非常糟糕!!!

When exception happens, the only way to restore application is to restart server, which is very bad!!!

这是完全例外:

将请求发送到服务器时发生传输级错误. (提供者:会话提供者,错误:19-物理连接不可用)

A transport-level error has occurred when sending the request to the server. (provider: Session Provider, error: 19 - Physical connection is not usable)

推荐答案

我现在确认,方法是将服务器上的连接字符串更改为使用".对于数据源而不是域名,异常似乎已经消失了.作为以前曾经工作过的域名,这很奇怪.必须是SQL Server上的某种更新

I confirm now, by changing connection string on the server to use "." for data source instead of domain name, exception seem to have disappeared. Very weird as domain name used to work before. Must be some sort of update on SQL Server

这篇关于无法摆脱“物理连接不可用".例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆