Compartilhar via


Resolve SocketExceptions in VSTS Web / Load tests

Socket exceptions can happen in following cases

  Because of your Load Test Agent machines

 Error : Exception SocketException An operation was attempted on a non-blocking socket that already had an operation in progress Stack

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An operation was attempted on a non-blocking socket that already had an operation in progress

   at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state)

   at System.Net.Sockets.Socket.UnsafeBeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)

   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)

Solution: Some times in corp networks load test agent/controller machines uses internet proxy setting in that case - Proxy server will reject connections to the targeted servers saying

  Because of DOS attack

Error : “No connection could be made because the target machine actively refused it <IP Address>”

 Solution1: If the connections are made directly (without proxy) and still if you encounter Socket Exception then that could be due to the fact that Webserver is rejecting the connections as it receiving connection requests from the same host. In that case try adding more agents to distribute the load and use as many as IP’s in Agent configuration settings to generate the targeted load.

Solution2: Sometimes due to settings in web.config you will not be able to generate the targeted load then adjust throttling settings based on the processors

 <behaviors>
            <serviceBehaviors>
                <behavior name="WIBSBehavior">
                    <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceThrottling maxConcurrentCalls="32" maxConcurrentSessions="30"/>
                </behavior>
            </serviceBehaviors>
</behaviors>

Comments

  • Anonymous
    January 01, 2012
    The comment has been removed