471,582 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,582 software developers and data experts.

Old Exception but new Headache - The underlying connection was closed: An unexpected error occurred on a receive

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
Jul 25 '06 #1
0 1451

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

26 posts views Thread by Rajeev Tipnis | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.