473,383 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Problems with WebRequest and Connection

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.
Nov 18 '05 #1
1 1462
GSK wrote:
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.


[...]

Are you using a proxy in IE? You don't specify one in your code.

Cheers,

--
Joerg Jooss
jo*********@gmx.net

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Aaron | last post by:
tcpclient socket webrequest what are each used for? I read some reference books and did some research on the internet, but I'm still confused. could someone clarify this for me? Thanks,...
0
by: Randy Chow | last post by:
Hello everyone I was wondering if anyone has come across my problem? I programmed a Windows Service that uses httpWebRequest and httpWebResponse in VB.NET. Everything works fine until I use the...
3
by: Paul | last post by:
Hello, First I want to refer to the problem "WebRequest : execute a button" of a few days ago. The way I solved it, I loose my session, and as a consequence my session variables. I don't want...
2
by: oliver.wulff | last post by:
Hi My ASP.NET application has to send https requests to other web servers quite often. I'd like to know how I should manage the connections? Does the method WebRequest.Create() reuses an existing...
2
by: Tyler | last post by:
I am using httpwebrequest to do a screen scrape. This works great on my development box, but does not on the production box. Here is the code. Dim webRequest As HttpWebRequest =...
2
by: kkb | last post by:
Hello! First, I'm sorry because of my english... I'll try to be understandable! I've got a strange problem using .NET 2003 C# and I haven't figured it out for a long time. I'm implementing an...
6
by: Jack | last post by:
I have a WebRequest object that I use to log into a site and then post some XML. In doing this I set the KeepAlive = true so that it maintains the connection and does operates undo the initial...
0
by: buccsailor | last post by:
Hell there, I tried to post a reply to a message thread created back in July 2006 regarding the override of WebRequest, Closed Conenctions and setting KeepAlive to false,but it's been over 60...
0
by: Solius | last post by:
I have been struggling for 4 days to write a connection to an XML REST API. I can't figure out what is wrong with my code that it won't connect propertly. The goal is to make a web service that...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.