Hi,
I am getting the following exception when using webservice..
"The underlying connection was closed: An unexpected error occurred on a receive"
I am not getting any innerexception so no clue for the reason.
While i was seaching on web, i found the solutions but its not working for me.
I have already override the method on client proxy [Reference.cs] but its not working,
protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
System.Net.HttpWebRequest objWebRequest =
(System.Net.HttpWebRequest) base.GetWebRequest(uri);
objWebRequest.KeepAlive = false; //Here i tried with true, but still not working
objWebRequest.ProtocolVersion = HttpVersion.Version10; //Here i tried removing this line, but still not working
objWebRequest.Timeout = 6000000; //Here i have tried with System.Threading.Timeout.Infinite but still not working
return objWebRequest;
}
My web service call scenario is:
- My webservice is used to send mail
- The mail attachment can be up to 10 MB [I have override Machine.Config setting for max request length of 4 MB and put "<httpRuntime executionTimeout="600" maxRequestLength="10240"></httpRuntime>" in web.config of webservice]
- If mail size is large then process takes long time [thats why i used TimeOut.Infinite]
- I noted a consitent behavior that it gives the above exception after 135 Seconds aprox.
- Even if with default maxRequestLength of 4MB, i have tried to send 3 MB mail but its not working
- For small size of mail attachment [<1MB] its working fine without any exceptions
Can anyone give me helping info or pointers please?
Thanks in Advance,
Regards,
Mahesh Devjibhai Dhola