function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
itstaff1.3920641347534116E12itstaff1.3920641347534116E12 

System.Net.WebException: The underlying connection was closed

We have a web service set up that allows one of our clients to automatically send us leads. It seems that they have been getting the following errors:

.System.Net.WebException: The underlyingconnection was closed: The connectionwas closed unexpectedly.
(This is all they provided me)

From what I have read in forums and discussions, the following code snippet needs to be added to the reference file in the solution that invokes the web service:
protected override System.Net.WebRequest GetWebRequest(Uri uri)
  {
   System.Net.HttpWebRequest webRequest =  (System.Net.HttpWebRequest) base.GetWebRequest(uri);
   webRequest.KeepAlive = false;
   return webRequest;
  }

Can anyone provide some insight if I am headed in the right direction, or is there something else that needs to be done?

Thanks.
ShashankShashank (Salesforce Developers) 
You may find this helpful: http://support.microsoft.com/kb/823177