通过基本HTTP绑定的自托管WCF服务不支持超过1000个并发请求 [英] A SelfHosted WCF Service over Basic HTTP Binding doesn't support more than 1000 concurrent requests

查看:90
本文介绍了通过基本HTTP绑定的自托管WCF服务不支持超过1000个并发请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过ASMX客户端使用的BasicHttpBinding自托管了WCF服务.我正在模拟1200个用户的并发用户负载.服务方法采用一个字符串参数并返回一个字符串.交换的数据小于10KB.通过使用Thread.Sleep(2000)语句,请求的处理时间固定为2秒.没什么额外的.我已经删除了所有数据库命中/业务逻辑.相同的代码段可以很好地运行1000个并发用户.将号码增加到1200个用户时出现以下错误.

I have self hosted a WCF Service over BasicHttpBinding consumed by an ASMX Client. I''m simulating a concurrent user load of 1200 users. The service method takes a string parameter and returns a string. The data exchanged is less than 10KB. The processing time for a request is fixed at 2 seconds by having a Thread.Sleep(2000) statement. Nothing additional. I have removed all the DB Hits / business logic. The same piece of code runs fine for 1000 concurrent users. I get the following error when I bump up the number to 1200 users.

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不匹配和大数据交换时报告此异常.但是在进行负载测试时绝对不要.我已经浏览了足够多的内容,并尝试了大多数选项,包括

1.启用跟踪和消息日志在服务器端.但是没有记录错误.
2.要克服端口耗尽问题,MaxUserPort设置为65535,而TcpTimedWaitDelay设置为30秒.
3. MaxConcurrent调用设置为600,MaxConcurrentInstances设置为1200.
4.打开,关闭,发送和接收超时"设置为10分钟.
5. HTTPWebRequest KeepAlive设置为false.

任何帮助将不胜感激.

谢谢.



This exception is often reported on DataContract mismatch and large data exchange. But never when doing a load test. I have browsed enough and have tried most of the options which include,

1.Enabled Trace & Message log on server side. But no errors logged.
2.To overcome Port Exhaustion MaxUserPort is set to 65535, and TcpTimedWaitDelay 30 secs.
3.MaxConcurrent Calls is set to 600, and MaxConcurrentInstances is set to 1200.
4.The Open, Close, Send and Receive Timeouts are set to 10 Minutes.
5.The HTTPWebRequest KeepAlive set to false.

Any help would be appreciated.

Thank you.

推荐答案



设置maxConcurrentSessions = 1200.
Hi,

set maxConcurrentSessions = 1200.


这篇关于通过基本HTTP绑定的自托管WCF服务不支持超过1000个并发请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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