Abhash786
Abhash786

Reputation: 901

WCF is getting timed out with socket exception

I have written a WCF service with NetTcp Binding.

 <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>

I have hosted my WCF service on IIS.

Service is working fine till 105 concurrent calls after that it start giving me socket error as mentioned below...

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'.

I have written my test case as per http://blogs.msdn.com/b/endpoint/archive/2011/05/04/wcf-scales-up-slowly-with-bursts-of-work.aspx

My questions are...

  1. How does WCf handle requests after it's capacity. Is there any pipeline or queued up request.
  2. How can I resolve this means no request should be errored out. It should wait until WCF service is free to accept new request.

THanks in advance.

Upvotes: 0

Views: 1819

Answers (1)

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65361

WCF will Queue requests when the limit of conncurrent requests is reached.

It is not possible to Ensure that no request will fail, but you can reduce the chance that it will happen. For example the Client has a timeout, the Queue for Processing has a timeout.

For details on which parameters you can configure see:

http://weblogs.asp.net/paolopia/wcf-configuration-default-limits-concurrency-and-scalability

Upvotes: 1

Related Questions