How to fix System.Net.Sockets.SocketException

95,399

Most of the time these are connectivity timeouts due to different IP protocols (IPV4/IPV6) between the two server/computers trying to communicate or extra authentication rules setup on one of the computers for outgoing or incoming connectivity. Ways to troubleshoot the issue:

  1. Review IIS logs
  2. Review EventLogs
  3. Try adjusting TCP/IP parameters in the registry to increase the time allowed to connect

http://msdn.microsoft.com/en-us/library/aa560610(d=printer,v=bts.20).aspx

Even though the above article references Windows 2003, I've discovered it applies to some 2008 environments.

Share:
95,399
Theomax
Author by

Theomax

Software Developer

Updated on July 10, 2022

Comments

  • Theomax
    Theomax almost 2 years

    I'm working on an ASP.NET MVC website, it has been installed on three different servers (the same code version), it works on two of the servers i.e the user can login, but on one server after the user has submitted their username and password, the following server error is displayed in the browser:

    Security Exception
    
    System.Security.SecurityException: Token not found
    

    The event viewer for the environment the error is occuring on shows the following two error messages at the point where th euser attempts to login:

    Could not init pool.
    System.Net.Sockets.SocketException (0x80004005): 
    A connection attempt failed because the connected party did not properly
    respond after a period of time, or established connection failed because 
    connected host has failed to respond (server ip address)
    

    And this error:

    Error: System.Security.SecurityException: Token not found
    

    Which is the server error displayed in the browser. This has in the past been resolved by deleting an authentication cookie, but that doesn't work for this error.

    I have tried setting the trust level in the web.config to full which didn't work. I have tried restarting IIS.

    Has anyone else come accross a similar problem? Could this problem be caused because a service of some kind isn't running? Any suggestions will be appreciated.