By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,732 Members | 1,429 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,732 IT Pros & Developers. It's quick & easy.

System.Net.WebException: The underlying connection was closed:

P: n/a
Team,
From a windows service, we consume a web service on another server and
occasionally receive System.Net.WebException: The underlying connection was
closed:. For some clients we call, we do not see this as we ran into this
previoulsy, made a posting, and received some suggested code to resolved.
The code was put in their proxy classes and was this...
protected override WebRequest GetWebRequest(Uri uri)
{HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);
webRequest.KeepAlive = false;
return webRequest; }
However, for the web service in question, we could not put that override
because it's proxy class inherits from class
Microsoft.Web.Services2.WebServicesClientProtocol (instead of
System.Web.Services.Protocols.SoapHttpClientProtoc ol ). Even though the code
builds ok - we recieve invalid cast exception at runtime on the first line.

Thus I either need a new solution for avoiding the System.Net.WebException:
The underlying connection was closed error as the original code snipet does
not work in proxy classes derived from
Microsoft.Web.Services2.WebServicesClientProtocol.
By the way we are deriving from
Microsoft.Web.Services2.WebServicesClientProtocol so we can send soap
security tokens in header.

Need soon! Thanks,
Tim
Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

I think you are dealing with the issue of running out of 'connections'
from the connection pool.

Hope this helps,

Marvin Smit.

On Wed, 26 Oct 2005 17:46:02 -0700, Tim Reynolds
<ti**********@online.nospam> wrote:
Team,
From a windows service, we consume a web service on another server and
occasionally receive System.Net.WebException: The underlying connection was
closed:. For some clients we call, we do not see this as we ran into this
previoulsy, made a posting, and received some suggested code to resolved.
The code was put in their proxy classes and was this...
protected override WebRequest GetWebRequest(Uri uri)
{HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);
webRequest.KeepAlive = false;
return webRequest; }
However, for the web service in question, we could not put that override
because it's proxy class inherits from class
Microsoft.Web.Services2.WebServicesClientProtoc ol (instead of
System.Web.Services.Protocols.SoapHttpClientProto col ). Even though the code
builds ok - we recieve invalid cast exception at runtime on the first line.

Thus I either need a new solution for avoiding the System.Net.WebException:
The underlying connection was closed error as the original code snipet does
not work in proxy classes derived from
Microsoft.Web.Services2.WebServicesClientProtocol .
By the way we are deriving from
Microsoft.Web.Services2.WebServicesClientProtoc ol so we can send soap
security tokens in header.

Need soon! Thanks,
Tim

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.