473,725 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Http WebRequest.Chec kFinalStatus(). .."

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(st ring url)
{
string _result;
WebResponse objResponse;
WebRequest objRequest = System.Net.Http WebRequest.Crea te(url);
objResponse = objRequest.GetR esponse();
using (StreamReader sr = new
StreamReader(ob jResponse.GetRe sponseStream()) )
{
_result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
return _result;
}

Thanks!

- gsk.
Nov 18 '05 #1
1 1490
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.Http WebRequest.Chec kFinalStatus(). .."

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
2637
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, Aaron
0
1408
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 webresponse object. What the Windows Service does is when the timer in the windows service elapses, the request to the website is made and a response is retrieve in a simple myhttpWebrequest.GetResponse(). I don't even do anything with the...
3
6350
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 to keep those variables, as an alternative, as ViewState variables because I don't want to transfer to many hidden fields. This is the code I use :
2
1451
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 https connection to the destination server or will a new one created for each call? Can several threads use the same instance returned by WebRequest.Create()? If yes, will the requests be serialized or will they be called in parallel? This is...
2
3332
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 = CType(webRequest.Create(LOGIN_URL), HttpWebRequest) webRequest.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy webRequest.KeepAlive = False
2
5970
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 application to download images using System.NET classes (webclient, webrequest) asynchronously behind proxy server. The reading method works like this: System.Net.WebClient client=new System.Net.WebClient();
6
10004
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 login. Is there a way to force this connection to close after I an done with it. What happens is that I may need to post the XML in several chunks due to size therefore I cannot set the KeepAlive to False when I post the XML and the way the code...
0
1171
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 days so I am creating a new topci in the hopes of an answer to a related issue. GhostAK suggested some vb.net code that should work to allow the setting of the Keep Alive property. yes, I am having connection close errors. The code suggested...
0
1530
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 connects directly to the REST API. When I code it as a front end doing a form post it works fine, but I can't code the VB on the backend to do the same thing. Any help would be much appreciated. Also, how do you convert the contents of a filestream...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.