G
GSK
This one has me stumped:
I am using HttpWebRequest to resolve an external URL (that outputs an XML
string). It works fine on my dev machine (W2K), and used to work on my
production machine (W2K3). It seems that now, for some reason, the
connection cannot be established. The error logged is:
The underlying connection was closed: Unable to connect to the remote
server." source="System" stack="at
System.Net.HttpWebRequest.CheckFinalStatus()..."
I can connect to the Internet via the browser on this machine, and all
network related services seem to be working. (Terminal services, etc.) I've
fiddled with the Timeout on the WebRequest object to no avail. The most
frustrating thing is that it recently worked - once - then stopped working
again. I'm not sure if it is a network issue, hardware issue, security issue
on W2K3, etc.?
Any help would be appreciated.
Here is the function called:
private string readHtmlPage(string url)
{
string _result;
WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
using (StreamReader sr = new
StreamReader(objResponse.GetResponseStream()) )
{
_result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
return _result;
}
Thanks!
- gsk.
I am using HttpWebRequest to resolve an external URL (that outputs an XML
string). It works fine on my dev machine (W2K), and used to work on my
production machine (W2K3). It seems that now, for some reason, the
connection cannot be established. The error logged is:
The underlying connection was closed: Unable to connect to the remote
server." source="System" stack="at
System.Net.HttpWebRequest.CheckFinalStatus()..."
I can connect to the Internet via the browser on this machine, and all
network related services seem to be working. (Terminal services, etc.) I've
fiddled with the Timeout on the WebRequest object to no avail. The most
frustrating thing is that it recently worked - once - then stopped working
again. I'm not sure if it is a network issue, hardware issue, security issue
on W2K3, etc.?
Any help would be appreciated.
Here is the function called:
private string readHtmlPage(string url)
{
string _result;
WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
using (StreamReader sr = new
StreamReader(objResponse.GetResponseStream()) )
{
_result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
return _result;
}
Thanks!
- gsk.