导致此 SqlException 的原因:从服务器接收结果时发生传输级错误
这是完整的错误:SqlException:从服务器接收结果时发生传输级错误.(提供程序:共享内存提供程序,错误:1 - 在读/写操作中检测到 I/O 错误)
对于我的应用程序中的一些单元测试(有超过 1100 个单元和系统测试),我开始间歇性地看到此消息.我正在使用 ReSharper 4.1 中的测试运行程序.
I've started seeing this message intermittently for a few of the unit tests in my application (there are over 1100 unit & system tests). I'm using the test runner in ReSharper 4.1.
另外一件事:我的开发机器是 VMWare 虚拟机.
One other thing: my development machine is a VMWare virtual machine.
推荐答案
我很久以前就遇到过这个问题.最重要的是,您的可用端口已用完.
I ran into this many moons ago. Bottom line is you are running out of available ports.
首先确保您的调用应用程序启用了连接池.
First make sure your calling application has connection pooling on.
如果是,则检查 SQL Server 的可用端口数.
If that does then check the number of available ports for the SQL Server.
发生的情况是,如果池关闭,则每个调用都会占用一个端口,默认情况下需要 4 分钟使端口过期,而您的端口即将用完.
What is happening is that if pooling is off then every call takes a port and it takes by default 4 minutes to have the port expire, and you are running out of ports.
如果启用了池,那么您需要分析 SQL Server 的所有端口并确保您有足够的端口并在必要时扩展它们.
If pooling is on then you need to profile all the ports of SQL Server and make sure you have enough and expand them if necessary.
当我遇到此错误时,连接池已关闭,只要在网站上放置了适当的负载,就会导致此问题.我们没有在开发中看到它,因为负载最多为 2 或 3 人,但是一旦人数超过 10,我们就会不断看到此错误.我们开启了池化,并修复了它.
When I came across this error, connection pooling was off and it caused this issue whenever a decent load was put on the website. We did not see it in development because the load was 2 or 3 people at max, but once the number grew over 10 we kept seeing this error. We turned pooling on, and it fixed it.
相关文章