Web service sporadic error : The underlying connection was closed: The remote name could not be resolved


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.WebException
Message: 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.GetRequestStream()....

Anyone has an idea what it could be?

Looks like this is the section of the code causing the problem based on the exception statck trace

webReq is the System.Net.HttpWebRequest object.

This is a section of the related code:

byte[] buffer = Encoding.UTF8.GetBytes(strData);

 webReq.Method ="POST";

webReq.ContentType = "application/x-www-form-urlencoded";

webReq.ContentLength = buffer.Length;

// open a stream for writing

Stream postData = webReq.GetRequestStream();

postData.Write(buffer, 0, buffer.Length);



Any feedback would be really appreciated!








10/29/2008 4:23:42 PM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 10

It seems the service url is not accessible or you used an illegal url.

Can you verify this url is accessible from internet explorer?
Maybe you need to define a proxy in order to reach this url.
Web Services Performance, Interoperability And Testing Blog
10/29/2008 6:55:45 PM

Yes, the problem was that the web server was not able to resolve the name of the webservice url.

We have a web farm with multiple servers and the problem seemed sporadic because it was only this one web server which was not able to resolve the name of the server hosting the webservice, all the other web servers were fine. When the page was served by the bad server it would result in the error and when it was any of the other good ones things were fine.

Thanks for your reply! :)



10/30/2008 6:35:03 PM

Please mark that reply as "Answered" so that others with the same problem will know that you have found a solution here.

John Saunders | MVP – Connected System Developer
11/1/2008 12:15:41 AM

Similar Artilces:

Web Service: The underlying connection was closed: Unable to connect to the remote server.
When I access the web service when I'm on the LAN at work everything functions fine. When I try and access the service from outside the firewall, I get the error. I'm not using a proxy server, I can access the VS.NET generated interface page just fine from outside the firewall as well. On the web server the hosts the web service I have port 80 and 443 open. What else do I need to do w/ the firewall, client app or the service to get it to work? If you could tell me of additional ports, or anything I need to do it would be appreciated. Thanks...

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...

Error trying to consume web services: Underlaying connection was closed. Unable to connect to the remote server
 HiI'm having an issue that is making me crazy. I have a small web application that have a dll library reference that is calling an external web service through port 11000. In my IIS localhost the web application works fine, and connect to the web service correctly.However, when I upload the web application to the server and I try to run it, the webservice returns 'Underlaying connection was closed. Unable to connect to the remote server'. I did a Google search for this and I found this issue may be caused by some firewall or proxy block, so I opened the in-out 11000 TCP por...

Web service name resolving error when attempting to call a web method
I have a website that calls an interal login web method at webservice.mycompany.local/login.asmx Every once in a while I get the following error: System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Net.WebException: The remote name could not be resolved: 'webservice.mycompany.local' Sometimes just trying the call over and over again will not work and I have to wait about 10 minutes for the name to be resolved, or if I go to the server and do an "ipconfig /flushdns" it usually fixes this issue. ...

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: ...

When creatign a web service how do you specify the Web Service Name?
Well when I create a web service it always defaults to the name WebReference, which I think is the default if no Web Service Name is provided. But when I use other people's web services there is another name there, so there has to be a way to provide a name so no default WebReference will be used. How do you do that? Actually I think there is no way, because it takes it after the URL. So if you have a web service from a place like so http://www.webservices.com then the WebRefrence chosen by Visual Studio will be com.webservices.www I'm not sure what you are asking, but you can rena...

.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 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.KeepAl...

The remote name could not be resolved
Hi, I am having an intermittent problem with .net 2.0 console client which consumes an Http Web Service. The client some times throws an The remote name could not be resolved error while tring to send packets to the web service. Any thing needs to be changed on client or server side?? Any help here is appreciated. Thanks in advance.Microsoft Certified Professional Developer - Web Developer...

Web Service: Underlying connection was closed.
I have a windows application that accesses an XML web service to retrieve a dataset. On some computers the service works fine. However, on others I get back the infamous "The underlying connection was closed error." I thought it was a permissions isse at first, but after messing with that for awhile I've come to the conlclusion that's not it because some computers where it is installed work fine. I'd appreciate any advice on this crucial matter.Thanks in advance... Read this... http://weblogs.asp.net/jan/archive/2004/01/28/63771.aspx Nobler sentiments, stronger minds-Francisco...

Calling a Web Service from a Web Service
Hello,I was looking for some feedback on calling a web service from within a web service. I've heard that it's not good practice (or not possible). I have a scenario where I think it might make some sense.Within our infrastructure, we've created a web service that handles incoming updates on the statuses of all processes. This has proven to be a good thing since it allows applications to communicate across server to make status updates. It's also used by third party developers and applications to communicate with our infrastructure.Along these lines ... we are planning to create a new compon...

Is web services a part of web Service?
  I have a question: Is web services a part of web server?? And when the client calls web service, it means that client calls web server?? Or is it a different entity in itself which communicates separately both with client and server and acts as middleware application.. I am very confused.. Can someone explain me the architecture...??? Thanks..Dont forget to click "Mark as Answer" on the post that helped you.This credits the member,earns you a point & marks your thread as Resolved so that new users will know where to search for their queries. When you build and dep...

Web resources about - Web service sporadic error : The underlying connection was closed: The remote name could not be resolved - asp.net.xml-web-services

Underlying - Wikipedia, the free encyclopedia
In finance, the underlying of a derivative is an asset , basket of assets , index , or even another derivative, such that the cash flows of the ...

The Underlying Technology of Messages
We're launching a new version of Messages today that combines chat, SMS, email, and Messages into a real-time conversation. The product team ...

Ezra Klein: The Deceptive Strategy Underlying ObamaCare - YouTube
Courtesy of www.verumserum.com. Follow us at: twitter.com/verumserum. Washington Post blogger Ezra Klein, speaking at the NetRoots Nation conference ...

Medication is masking the underlying issues
As an educator, I have watched the wave of Attention Deficit Hyperactivity Disorder medication spread as a ''fix all'' for many of our young ...

Bitcoin’s continuing price fall unmasks its underlying flaws. Is this its end?
Bitcoin was dubbed the worst investment of 2014. And things don't look too good for the digital currency in 2015 either.

Google overtakes Apple as world’s most valuable tech company – by ‘underlying value’ measure
Over on 9to5google , we posted an interesting perspective by the Wall Street Journal suggesting that Google now has greater ‘underlying value’ ...

Climate announcement masks underlying tension over Xi Jinping visit to Washington
China's President Xi Jinping was greeted by a 21-gun salute at the White House lawn on Friday, but the official welcoming ceremony couldn't mask ...

CNN’s domestic ratings woes mask underlying strengths
When he announced his departure from CNN last month, President Jim Walton said the Atlanta-based news network needed “new thinking” and a plan ...

Point of sale systems at risk from underlying vulnerabilities
... Charles Henderson vice president of managed security testing at information security specialist Trustwave believes that there's a bigger underlying ...

"It was a clever, bright show on the surface, but its underlying message declared that marriage was ...
Said Dean Jones, Stephen Sondheim musical “Company.” Not long after the opening night of the musical — in which he played the central role of ...

Resources last updated: 12/1/2015 12:06:35 PM