.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Invoking a web method fails with 'The underlying connection was closed: Unable to connect to the re

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :.NET Framework
 

Hi all,

i am currently challenging a problem that suddenly started to happen in my production environment when invoking a WS method from a windows-service .NET app.

The windows service is waiting for requests incoming through MQ, unwraps these requests from an "MQ XML packet" and redirects these requests to the web service. This web service has only one web method, which is kind of "main entry point" for the underlying backend application.

This monday approx. 30% of attempts to invoke that web method are failing with message: The underlying connection was closed: Unable to connect to the remote server.   
      CallStack:   
      at System.Net.HttpWebRequest.CheckFinalStatus()   
      at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult)   
      at System.Net.HttpWebRequest.GetRequestStream()   
      at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object?! parameters)   
      at MyWebService.GetResponse(String requestMessage, String& responseMessage)   
 &n


View Complete Post


More Related Resource Links

The underlying connection was closed: Unable to connect to the remote server.

  

Hello,

 

I get this error message when i kick off my web service to run. It gathers survey feedback from a database via http soap. Recently i put in a proxy that is required for access to internet. The web service started to fail that day as well. Can anyone tell me how i could hard code the proxy that should be used by the web service? I found this link: http://support.microsoft.com/kb/307220

and tried editing the machine.config file but that didn't fix my issue. Any Ideas?

 

Error:

 

8/2/2007 1:02:25 PM
The underlying connection was closed: Unable to connect to the remote server.
   at System.Net.HttpWebRequest.CheckFinalStatus()
   at Syst

The underlying connection was closed: An unexpected error occurred on a send.

  

I am consuming a third party web service wsdl using my .net aps.net page. And I am getting following error message. Cannt get to resolve it. Its working on my machine but not in my development machine. I have installed the certificate also in certificates on that machine. Can somone please help.?

Error -->  The underlying connection was closed: An unexpected error occurred on a send.

 

 

 

 


System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a rec

  
Hello Guys,         I am getting following exception while web service (ASMX) is returning the response. <!-- [if gte mso 10]> <mce:style> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive.     <!-- [if gte mso 10]> <mce:style>                                                     InnterException (System.IO.Exception): "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."       I think either the Asp.net web server is closing the connection or the response is too long.   Following is my simple code.    1)   namespace JFA.IndiePay.BusinessAccess { public class VerTexProcessor { public DataSet ProcessVerTexForBatch(DataSet dsInputRequest) { DataSet dsResponse = new DataSet(); //Call vertex web service here. VertexService.Service texCalculator = new VertexService.Service(); texCalculator.Timeout = 500000;

The underlying connection was closed: An unexpected error occurred on a receive

  
Hi All,   i have developed a web application to call WCF service (which is hosted in IIS) from client application using .Net 1.1 it works fine.   but i got an error "The underlying connection was closed: An unexpected error occurred on a receive." when the return object is getting complex.   i analysis the issue with different level of object complexity and i found it get failed for following structure.   eg:   ObjectA - outer object that has some primitive data types and the list of ObjectB ObjectB - this also contain some primitive data and list of ObjectC.   Hope you can understand the hierarchy (complexity) of the return object. This works up to 2nd level of object hierarchy.   Does anyone have idea about the solution for this exception?   Thanks in Advance Shazvi

Exception: "The underlying connection was closed: The connection was closed unexpectedly." (sometime

  
I have a windows app connecting to a webservice.  In some situation(s) (haven't narrowed it down enough), I get the following exception: The underlying connection was closed: The connection was closed unexpectedly. When this exception is thrown, it is calling a method of a web reference. Now the situation that we experience this is on a laptop in the field that is using a WWAN connection in at least one location.  It works fine in the lab at the office.  Anyone have any ideas what could be causing this?

"The underlying connection was closed: The connection was closed unexpectedly."

  
HI, I am getting error as "The underlying connection was closed: The connection was closed unexpectedly." The problem occured when data is heavy. i have set to maxBufferpool size and MAxBoolsize also high. Stack Trace of the Error: Server stack trace:    at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)    at System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)    at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)    at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout)    at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout)    at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan tim

WCF Service fails with Unexpected connection closed with large amount of data

  
Good day all,   I'm sure this question is relatively simple, but I'm quite new to WCF (been on a Java project the last few years and it's nice to be back in MS territory even if a lot has changed!).   Anyway, here's all the details of my scenario I was hoping someone could shed some light on.   1)  This WCF service is hosted as a webservice and is being testing in the WCF Test Tool. 2)  There is a method call on the service that, while rarely used, can return a fair amount of data (over 20,000 objects) - this is a requirement of the system 3)  The object that is being serialized has the following signature/contract (property changed for example): [DataContract] public class Foo { private string prop1; [DataMember] public string Prop1 { get { return prop1; } set { prop1= value; } } private string prop2; [DataMember] public string Prop2 { get { return prop2; } set { prop2= value; } } private string prop3; [DataMember] public string Prop3 { get { return prop3; } set { prop3= value; } } private string Prop4; [DataMember] public string FaaCode { get { return prop4; } set { prop4= value; } } private string prop5; [DataMember] public string Prop5 { get { return prop5; } set { prop5= value

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure

  

I've gone through lot of articles and not one solution worked for me:

I'm having IIS 7 on Windows 2k8 with SSRS 2008.

How SSL is configured: Its configured to access SSL over existing web-site. final url looks like https://url/reports. When I enter this URL I get the error message.

But, if I connect to same site using non SSL website from my local machine, it works fine. For example, if i use VS 2008 web server and connect to it, it works and shows me report, but as soon as I deploy it on webserver having SSL enabled, it just throws this message.

 

Somebody please help me wid this one


Not so important

...The underlying connection was closed: The connection was closed unexpectedly. at System.Net.Web

  

I have a WCF service with the following lines of code:

WebClient Client = new WebClient();

Stream strm = Client.OpenRead(fPath); < -- Exception Occurs exactly here

Everything works great when I am hosting the service via the ASP.NET Development server, but when I publish the service to IIS, the following runtime error is thrown:

The underlying connection was closed: The connection was closed unexpectedly.\r\n   at System.Net.WebClient.OpenRead(Uri address)

As stated, the program opens the file without any problems when the service is hosted in the ASP.NET development server.  When hosted in IIS, an exception is thrown at the location specified above.  I thought that it might be an issue of security, so I went berserk in permission granting.  I sort of ruled that out at this point as every group has full access and the exception is still being thrown.

Any assistance on this would be greatly appreciated...


System.Net.WebException Message=The underlying connection was closed: The connection was clos

  

Hi,

I have a work flow developed in vs2010 WF4 exposed as service. I am consuming this service in a test web application, whenever service returns i get the following exception:

System.Net.WebException       Message=The underlying connection was closed: The connection was closed unexpectedly.

If i return a string it works fine, whenever i deserialize my result into an object and return that object i get the above mentioned error.

 

Regards,

Hassam


System.Net.WebException Message=The underlying connection was closed: The connection was clos

  

Hi,

I have a work flow developed in vs2010 WF4 exposed as service. I am consuming this service in a test web application, whenever service returns i get the following exception:

System.Net.WebException       Message=The underlying connection was closed: The connection was closed unexpectedly.

If i return a string it works fine, whenever i deserialize my result into an object and return that object i get the above mentioned error.

 

Regards,

Hassam


"The underlying connection was closed: The connection was closed unexpectedly"

  

Hi,

Im working with this Arquitecture : 

Web Service  -> DLL(Xml Translator)  -> Asp.net.

Everything works fine, but,i have a process that takes about 23 minutes, in that time i show a "loading screen" that avoid the user to do anything, but  after 20 mins while the web service is working and after debug my code, i get this error :

"The underlying connection was closed: The connection was closed unexpectedly"

Then, my "loading screen" keep visible until  the web service completes the work, and after that, the "loading" hides and the web form shows my gridview empty.(its should show data).

Regards and thanks.




The underlying connection was closed: The connection was closed unexpectedly.

  

Hi,

This error stopping my work in my crucial time. The error is "The underlying connection was closed: The connection was closed unexpectedly.".

There are multiple WCF service I created in my project. But when I am requesting only one service this error is coming. I compare with other service, no difference. The service works fine in the morning, but afternoon it stops working and raising error.

I installed Silverlight 3.0 Tools for 2008 Sp1, Silverlight 3.0 Developer, WCF RIA Beta and Silverlight 4.0 runtime in my system in the morning. After getting this error I uninstalled WCF RIA Beta. But same issue.

Could not find any solution. Please assist me how to solve this issue.

Many Thanks, Kelvin.


The underlying connection was closed: The connection was closed unexpectedly.

  

 

hi all,

 

i am getting an error while returning data from WCF Service i am getting collection of workitem type bugs from tfs and with the help of WCF service i am exposing them to client. i have changed the maxmessage size, time out e.t.c.

 

but problem remains there. following is the error.

 

The underlying connection was closed: The connection was closed unexpectedly.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.

Source Error:

Line 141:        
Line 142:        public object[] fillRptBugs(string p, string s) {
Line 143:            return base.Channel.fillRptBugs(p, s);
Line 144:        }
Line 145:    }

Source File: c:\teamfoundationserverapplication\wcfservic

Opening an ASP.NET page in JS pop up error - The underlying connection was closed: An unexpected err

  

Hello there,

I was required to show a page content (HTML form) in a java script popup window. The application is built on ASP.NET technology. Since the content to show is dynamic i.e.it is decided at run time what to show. So I used HttpWebRequest/HttpWebResponse classes to get the HTML content that is to show in the JS Pop Up window.The resulting response string is displayed with the use of PlaceHolder control.

Before load balancing, it was runing perfectly. But the implementation ofthe load balancing, it starts throwing error. The error is as follows:

System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. at System.Net.HttpWebRequest.CheckFinalStatus() at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Net.HttpWebRequest.GetResponse()

I have replaced the HttpWebRequest/HttpWebResponse classes with System.Web.WebClient but it is still throwing the same error.

Please help.




.NET Framework 4.0 error - The underlying connection was closed: An unexpected error occurred on a s

  

Hello,

I'm receiving the following error occasionally when calling web service using a .NET 4.0 web application. 

"The underlying connection was closed: An unexpected error occurred on a send."

All of the articles I've read regarding this issue are for the Framework 1.1.

Is there any solution to this issue for using .NET framework 4.0?

Thanks in advance.


SP2010 InfoPath error: The underlying connection was closed: Could not establish trust relationship

  

Site: https://sp.xxxx.com/TestSite

When the InfoPath form is loading, I get the following error:

An error occurred querying a data source.

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

An entry has been added to the Windows event log of the server.

Log ID:5566

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend