我已经在
这个异常通常在DataContract不匹配和大数据交换时报告。但是进行负载测试时从未出现过。我已经浏览了足够的资料,并尝试了大多数选项,包括:
希望得到任何帮助。
谢谢。
BasicHttpBinding
上自托管了一个WCF服务,由一个ASMX客户端
消费。我正在模拟并发用户负载,达到1200个用户。该服务方法需要一个字符串参数并返回一个字符串。交换的数据小于10KB。通过Thread.Sleep(2000)语句将请求的处理时间固定在2秒钟左右。没有其他操作。我已经删除了所有DB Hits /业务逻辑。
同样的代码在1000个并发用户下运行良好。但是当我将数量增加到1200个用户时,会出现以下错误。
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at WCF.Throttling.Client.Service.Function2(String param)
这个异常通常在DataContract不匹配和大数据交换时报告。但是进行负载测试时从未出现过。我已经浏览了足够的资料,并尝试了大多数选项,包括:
- 在服务器端启用Trace和Message日志记录。但没有记录到错误。
- 为了克服端口耗尽,将MaxUserPort设置为65535,TcpTimedWaitDelay设置为30秒。
- 将MaxConcurrent Calls设置为600,将MaxConcurrentInstances设置为1200。
- 将Open、Close、Send和Receive超时设置为10分钟。
- 将HTTPWebRequest KeepAlive设置为false。
希望得到任何帮助。
谢谢。