472,977 Members | 2,049 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

The underlying connection was closed: Unable to connect to the rem

Hi,

I am trying to use a web service on an ISPs server and keep getting the
following message:

"The underlying connection was closed: Unable to connect to the remote server"

Fortunately (so I thought), looking on the web
(http://p2p.wrox.com/topic.asp?TOPIC_ID=4858 for example), this seems to be a
known problem and the solution apparently is to add the following code to the
reference.cs

protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest)
base.GetWebRequest(uri);
webRequest.KeepAlive = true;
return webRequest;
}

I have converted this to vb as follows:

Protected Overrides Function GetWebRequest(ByVal Uri As Uri) As
WebRequest

Dim webRequest As HttpWebRequest =
CType(MyBase.GetWebRequest(Uri), HttpWebRequest)

webRequest.KeepAlive = True
Return webRequest

End Function

An import of system.net is also required.

I put this in the reference.vb file accessible from the web references
section of a dll which runs on the client.

Unfortunately this doesn’t have any effect and I am wondering what to do now.

Please could someone give me some suggestions.

Steve Bugden.
Nov 23 '05 #1
1 4423
SOme other points that I can now add.

The ISP for the machine that my application is hosted on tells me that my
application is breaking the application pool.

I am now getting an "Service unavailable" message, I have read that IIS can
shut down applications that continually break the App pool.

I have developed the application using visual studio 2002 and therefore it
uses the .net framework 1.0 and the ISP has it running under 1.1. Is this a
likely cause or should the a 1.0 application run under 1.1 OK?

"Steve Bugden" wrote:
Hi,

I am trying to use a web service on an ISPs server and keep getting the
following message:

"The underlying connection was closed: Unable to connect to the remote server"

Fortunately (so I thought), looking on the web
(http://p2p.wrox.com/topic.asp?TOPIC_ID=4858 for example), this seems to be a
known problem and the solution apparently is to add the following code to the
reference.cs

protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest)
base.GetWebRequest(uri);
webRequest.KeepAlive = true;
return webRequest;
}

I have converted this to vb as follows:

Protected Overrides Function GetWebRequest(ByVal Uri As Uri) As
WebRequest

Dim webRequest As HttpWebRequest =
CType(MyBase.GetWebRequest(Uri), HttpWebRequest)

webRequest.KeepAlive = True
Return webRequest

End Function

An import of system.net is also required.

I put this in the reference.vb file accessible from the web references
section of a dll which runs on the client.

Unfortunately this doesn’t have any effect and I am wondering what to do now.

Please could someone give me some suggestions.

Steve Bugden.

Nov 23 '05 #2

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

Similar topics

22
by: Kristof Thys | last post by:
Hello, I'm developing a C# - windows forms application. To get some information for my application, I'm connecting to an URL, wich gives me XML generated using php. With 90% of the users, this...
0
by: Luis Esteban Valencia | last post by:
I have an application on my intranet It works fine there when I copied the proyect to the server of the Internet it gives me this error. The arquitecture of my servers are. There is one Server...
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
3
by: MattM | last post by:
I am getting the "The underlying connection was closed: Unable to connect to the remote server" message when trying to connect an ASPX page to a simple Hello World web service. I have read a few...
1
by: Jim | last post by:
I have the following code: Line 35: Dim sURL As String = "http://www.google.com" Line 36: Dim data As Stream = client.OpenRead(Server.UrlPath­Encode(sURL)) Line 37: ...
2
by: geno | last post by:
Hello, When using VB.Net to connect ot a web service, I am getting the error The underlying connection was closed: Unable to connect to the remote server What could be causing this? ...
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
3
by: Monty | last post by:
OK, I had an issue with this and found lots of advice that did not apply, so I'm posting what I found hoping it might help someone else. Here's the sitch: you have a COM app that calls to a .Net...
3
by: nandan | last post by:
Yes. My client has a proxy server. That much i know. In my application I make two kinds of calls that are affected by the proxy server I finally got the webservice call working. But my...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.