Web service Exception: 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

Mahesh Devjibhai Dhola
0
Indian
7/25/2006 7:59:09 AM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

0 Replies
928 Views

Similar Articles

[PageSpeed] 49

Reply:

Similar Artilces:

Web Exception was unhandled by usercode, "The underlying connection was closed: An unexpected error occurred on a receive." Exception error
  I am using a web service. I got the error: Web Exception was unhandled by usercode. The underlying connection was closed: An unexpected error occurred on a receive.  Thanks,Bharathi Hi, Under my environment, I can't see the figure which you gave. And based on my research, please refer to the following link below for more information about this issue. http://forums.asp.net/t/1114812.aspx   Please feel free to let me know if I’ve misunderstood anything.Sincerely,Zong-Qing LiMicrosoft Online Community Support Please remember to click “Mark as Answer” on the post ...

Error occure while calling a WCF Service.(The underlying connection was closed: The connection was closed unexpectedly.)
  Hi,I am using WCF service in my application. when i call a method in the service. i get the following error- System.ServiceModel.CommunicationException: The underlying connection was closed: The connection was closed unexpectedly.Please Help!...

Unable to start debugging on the web server. The underlying connection was closed: An unexpected error occurred on a receive
Hi, i was involved with this problem for days. i created a web site in visual studio 2005,but i got this error when i try to run (F5): Unable to start debugging on the web server. The underlying connection was closed: An unexpected error occurred on a receive i have tried many things but it didn't work yet! Could any one help me ? vaassu has the same problem:http://forums.asp.net/t/1118381.aspx# If you found a solution already please tell me how did you solve it?...

xml web service --uploading the file to the xml web service
how can we upload the file in the xml web service 1.i mean what will be the return value in the proxy class 2.and how am i going to send the file to the xml web service----regards Bipul Kumar Here are some links to articles that helped us get this done: http://msdn.microsoft.com/webservices http://www.microsoft.com/downloads/details.aspx?familyid=06255a94-2635-4d29-a90c-28b282993a41&displaylang=en https://www.sys-con.com/dotnet/article.cfm?id=458 Hope this helps....

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

Web service in .NET from Java Web Service
Hi there,I'm pretty new to .net (although i have years of experience with the old vb 6, access 2k, as well as java)... and need some with perhaps either some syntax or something.Here is the wsdl.<wsdl:definitions targetNamespace="http://www.dynix.com/schema/book">−<wsdl:types>−<schema targetNamespace="GetBookInfoByISBN">−<complexType name="BookInfoType">−<sequence><element maxOccurs="1" minOccurs="0" name="Title" nillable="true" type="xsd:string"/><element maxOccurs=&quo...

Exception while calling .NET web service | System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
Hi,   We have written a .NET web service which retrieves an xml file from the database. This web service is SSL secured and requires client certificates for connection.   Problem: The web service is throwing an exception while retrieving large files. It works fine when the file size is around 1 MB, but fails with a file size of around 65 MB with the following exception: System.InvalidOperationException: There is an error in XML document (1, 38455668). ---> System.IO.IOException: Unable to read data from the transport connection. ---> System.Net.Sockets.SocketException: ...

.NET web services Vs Java Web Services
Hello, does anyone know of a book or good source of information that compares .NET and Java Web Services? (I would like soemthing neutral if possible). I am thinking of approaching this subject for my dissertation? Many Thanks Rob Hi Rob, Last year I had to give a powepoint presentation on Web Services. I noticed some good books at barnes and noble that discussed the subject. These books were specific to Java and discussed Web Services in a very clear fashion. They gave some elementary examples that were easy to understand. I have not yet had the pleasure of creatin .NET Web Servi...

Web service sporadic error : The underlying connection was closed: The remote name could not be resolved
Hi, We have a web service which works fine most of the time but has been giving sporadic "The underlying connection was closed: The remote name could not be resolved"  errors. The exception stack traces the source of the error to the following - Exception: System.Net.WebExceptionMessage: The underlying connection was closed: The remote name could not be resolved.Source: System   at System.Net.HttpWebRequest.CheckFinalStatus()   at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult)   at System.Net.HttpWebRequest.Ge...

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive.
Hi all, I am  getting the same problem "System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive."I have installed the client certificate on my development maching(Window XP). i m using the following code.. HttpWebResponse  result = null;      //System.Web.UI.Page  obj = new System.Web.UI.Page();       try   {     HttpWebRequest req = (HttpWebRequest)WebRequest.Create(m_url);    req.Credentials  = CredentialC...

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive
Hello: I created a win form application which attempts to consume a web service on a remote machine. I receive the following message when trying to invoke the web service: "An unhandled exception of type 'System.Net.WebException' occurred in system.web.services.dll Additional information: The underlying connection was closed: An unexpected error occurred on a receive. ************** Exception Text ************** System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. at System.Web.Services.Protocols.WebClientProto...

ystem.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive
 hi !! I am trying to copy a file from an ftp  . using WEbClient. Here is my sample code :try { string videoName= "DarkKnight.flv"; Uri uri = new Uri("ftp:/host/oflaDemo/streams/" + videoName);                 WebClient webcl = new WebClient();                 webcl.Credentials = (new NetworkCredential("ftpusername", "password"));          &n...

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive.
Hi,  I am getting this error System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. Everything works fine with ASP.NET WebServer but whn i Publish it on IIS 6 on Windows Server 2008, i stops and gives the above error, which is the case I need to handle. There are some posts for the same but didn't solve my problem like http://support.microsoft.com/kb/826210 http://chestermr.blogspot.com/2006/02/underlying-connection-was-closed.html All says to keep the alive connection property to false or extend it. But it is not working fo...

The underlying connection was closed: An unexpected error occurred on a receive. net 3.5 Options
Hi, I have created a asp.net page which posts XML on the web service using .net 2.0. The page and the webservice was working fine but once I converted them to .net 3.5 I have been getting following exception. And I am having this problem on the local machine that is both of them on same machine. Exception: System.Net.WebException was caught   Message="The underlying connection was closed: An unexpected error occurred on a receive."   Source="System"   StackTrace:        at System.Net.HttpWebRequest.GetResponse()    at PROXY...

Web resources about - Web service Exception: The underlying connection was closed: An unexpected error occurred on a receive - asp.net.xml-web-services

Resources last updated: 11/23/2015 5:22:46 PM