我已经使用NetTcp绑定编写了一个WCF服务。
<bindings>
<customBinding>
<binding name="CustomNetTcpBinding" closeTimeout="00:01:00" openTimeout="00:03:00" receiveTimeout="00:15:00" sendTimeout="00:15:00">
<transactionFlow />
<gZipMessageEncoding enableCompression="true" innerMessageEncoding="textMessageEncoding">
<readerQuotas maxDepth="999999999" maxStringContentLength="999999999" maxArrayLength="999999999" maxBytesPerRead="999999999" maxNameTableCharCount="999999999" />
</gZipMessageEncoding>
<windowsStreamSecurity />
<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
<netTcpBinding>
<binding name="TcpAuthWindows" closeTimeout="01:01:00" openTimeout="01:10:00" receiveTimeout="01:10:00" sendTimeout="00:10:00" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="21474836470" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" algorithmSuite="Default" />
</security>
</binding>
</netTcpBinding>
</bindings>
我在IIS上托管了我的WCF服务。
服务工作正常,直到105个并发调用之后才开始给我套接字错误,如下所述......
The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '01:09:59.1099110'.
我按照http://blogs.msdn.com/b/endpoint/archive/2011/05/04/wcf-scales-up-slowly-with-bursts-of-work.aspx
我的问题是......
提前谢谢。
答案 0 :(得分:1)
当达到并发请求的限制时,WCF将对请求进行排队。
不可能确保没有请求失败,但您可以减少它发生的可能性。例如,客户端有一个超时,处理队列有一个超时。
有关您可以配置哪些参数的详细信息,请参阅:
http://weblogs.asp.net/paolopia/wcf-configuration-default-limits-concurrency-and-scalability