469,609 Members | 1,146 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

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 4284
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

26 posts views Thread by Rajeev Tipnis | last post: by
3 posts views Thread by MattM | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.