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

I created a webservice, which get some information about certain typpe of items from about 4 suppliers. My webservice was working fine and getting proper result from all the suppliers servers, until one the suppliers changes  its production server link. After making changes with the new link, I m receving error:
The underlying connection was closed: Unable to connect to the remote .
the code i m using is:
NetworkCredential nc = null;
Uri uri = null;
nc = new NetworkCredential("NewUserName","NewPassword");
string requset = "xml=" + strRequestXml;
uri = new Uri(NewURL + strRequestUrl);
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
CredentialCache cc = new CredentialCache(); 
cc.Add(uri, "Basic", nc);
httpWebRequest.Credentials = cc;
string postData = requset;
ASCIIEncoding encoding = new ASCIIEncoding();
byte[]  byte1 = encoding.GetBytes(postData);
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.ContentLength = postData.Length;
Stream newStream = httpWebRequest.GetRequestStream();

At this point exception raise, containing error message which is
"System.Net.WebException: The underlying connection was closed: Unable to connect to the remote server.\r\n   at System.Net.HttpWebRequest.CheckFinalStatus()\r\n   at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult)\r\n   at System.Net.HttpWebRequest.GetRequestStream()\r\n 

My webservice still getting proper results from the remaning suppliers.
Can some help me for solving this issue as its really urgent.
Thanks.
Arif.

0
onlyarif
11/12/2005 8:44:34 AM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

2 Replies
717 Views

Similar Articles

[PageSpeed] 53

Arif,

I ran into the exact same problem and solving it was simple and unexpected. 

By deleting the web reference and recreating it, the problem was solved.  When changing from one server to another, changing the web reference URL in the properties window, and then selecting update web reference, even though it will sometimes work, it does not always work.  Why?  I can't say.

(Here is what happened:  working on a windows app which called a web service running on my development box; Decided to move the web service to another server.  Once it was moved, instead of deleting the web reference and recreating it, I simply changed the URL clicked update web ref... This was deceitful in that it worked when running the client on my box.  But when installing the client on another box it did not work, returning the exact error you specified.  So, if you have not solved it yet, that’s one quick thing to try)

Philip

 

 

0
notyet
12/8/2005 3:54:43 PM

Arif,

Have you tried deleting the web reference and recreating it.  This solved the problem for me.

notyet

0
notyet
12/8/2005 5:15:25 PM
Reply:

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

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 Referenced WSDL always getting "The underlying connection was closed: Unable to connect to the remote server." error
I'm getting "Exception Details: System.Net.WebException: The underlying connection was closed: Unable to connect to the remote server." on reference.cs file.I looked up this error and there were fixes for it, if it was occuring intermittently (I applied it anyway without success).  However my error seems to be permanent.  FYI, web service is Java based and client is of course .NET based.  Does it sound like service provider issue?Thanks in advance Java Web Server shouldn't be a problem;There are many reason why this can happen:1.Check if your personal Fir...

The underlying connection was closed: Unable to connect to the remote server.
Hi guys, I have problem with the above HTTP response while trying to post a request from one aspx (from A site) to another aspx page (at B site) which is hosted at the same web server. Which particular area should I pay attention to ?? Thanks ictie...

The underlying connection was closed: Unable to connect to the remote server.
I have the following problem with all the web services clients I created. What could be wrong? The underlying connection was closed: Unable to connect to the remote server. 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: Unable to connect to the remote server. Source Error: Line 35: [System.Web.Services.Protocols.SoapDocumentMethodAtt...

The underlying connection was closed: Unable to connect to the remote server
Hi, I am getting this error message.I am using myWebClient.OpenRead(uriString) method. Stack Trace is     Accessing http://www.amfiindia.com/portal/upload/downloadnav.txtException  The underlying connection was closed:  Unable to connect to the remote server.stackrace at System.Net.HttpWebRequest. Here is my code private void Button2_Click(object sender, System.EventArgs e) { try { // Create a new WebClient instance. // Just file reader WebClient myWebClient = new WebClient(); // Download home page data. string uriString="http://www.amfiindia.co...

Underlying connection was closed. Unable to connect to remote server.
The subject is the error i get when i try to consume my webservice from my web application running on a machine outside of our firewall. Inside everything works like a charm. The machine that runs the web app is a windows 2000 server which uses a proxy. I can connect to and get information from my webservice through a browser without any problems. When i try to do it programatically from inside my webapp it fails. I found a few suggestions of things to try such as: modifying machine.config file to include the address of the proxy like so: <proxy usesystemdefault="f...

The underlying connection was closed: Unable to connect to the remote server.
Hello, all... I'm in the process of trying to deploy a web app to a W2K box. The application itself installs flawlessly, but when I try to generate a report, I get the following error: -------------------------------------------------------------------------- The underlying connection was closed: Unable to connect to the remote server. 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: Unable to connect to the remote server
 I`m getting the error: The underlying connection was closed: Unable to connect to the remote server[WebException: The underlying connection was closed: Unable to connect to the remote server.] System.Net.HttpWebRequest.CheckFinalStatus() +677 System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult) +74 System.Net.HttpWebRequest.GetRequestStream() +233 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +105 myapp.myapp.Login(String User, String Password) myapp.WS.WS_Test.RUN_Login.Page_Load(Object sender,...

The underlying connection was closed: Unable to connect to the remote server.
Not my code. I purchased Enterprise Forms. It is suppose to email the data from the form submitted using the following code to receive the forms data and store in a string. The last line is where the code is throwing the error.The dev server runs it properly the live server has the problem. The are both 2k3 server. Using same firewall and DNS settings. System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);       req.CookieContainer = new System.Net.CookieContainer();      for(int i = 0; i <...

The underlying connection was closed: Unable to connect to the remote server
I am writing a valid link checker but get an error of "The underlying connection was closed: Unable to connect to the remote server" It seems to only happen if there is a www in the link. What is the best way to approach this Dim httpReq As HttpWebRequest = CType(WebRequest.Create(strLinkURL), HttpWebRequest) httpReq.AllowAutoRedirect = False httpReq.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy() httpReq.Credentials = CredentialCache.DefaultCredentials ...

underlying connection was closed:unable to connect to remote server
I have been receiving this exception for over a week with a .NET remoting app and can't find a solution anywhere that works.  Below I'll paste my config files and the client code calling the remote method.  I'd really appreciate some assistance. The Server code and files are on a remote server within our facility and have been told more than once there is no firewall between my workstation and it.  So firewalls are out of the question as the source of the problem.  I assume its somewhere in my config files but I've tried everything I've seen on the net. I receive the Net...

HttpWebRequest
I am developing an asp.net/vb.net web application locally on my development pc. My development pc is a member of a Small Business Server 2000 (SBS) domain and as such it connects to the internet thru the proxy server (ISA) on the SBS. I am trying to process a credit card transaction using HttpWebRequest as follows: webRequest = CType(webRequest.Create("https://www.viaklix.com/process.asp"), System.Net.HttpWebRequest) With webRequest .KeepAlive = False .Method = "POST" .ContentType = "application/x-www-form-urlencoded" ...

Web resources about - The underlying connection was closed: Unable to connect to the remote server. #2 - 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 ...

Qantas eyes bumper first-half underlying pretax profit of $875m to $925m
... was &quot;very committed&quot; to returning excess cash to shareholders after the company forecast it would report a bumper first-half underlying ...

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: 1/12/2016 8:34:46 AM