473,241 Members | 1,430 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,241 software developers and data experts.

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

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
1 3439
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jonathan Crowther | last post by:
On one PC the following test code results in an error on the GetResponse line while it works OK on another PC. The only difference that I am aware of is that the one that works is XP while the...
0
by: Kumar | last post by:
Hi all, I have the following code which uses WebClient.UploadValues myNameValueCollection.Add("Name", name) myNameValueCollection.Add("Age", age) .............. ............. Dim web As New...
5
by: Sachin Surana | last post by:
We use HttpWebRequest to send the request at a URL. But some times the method GetResponse throws a time out exception. But when we check the IIS logs, there is no such entry. So the request never...
1
by: etantonio | last post by:
Good morning, I've a problem, in the past I translate my site from google or altavista with a code similar to this : <%@ Page Language="c#" Trace="true" Debug="true" %> <%@ import...
5
by: Tim Reynolds | last post by:
My app calls a web service. After a few minutes of inactivity, we receive: System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. A call...
0
by: Seth Thibodeaux | last post by:
I have built a Windows Service that connects to Sql Server 2000 Reporting Services via its Web Service interface for the purpose of generating reports. Intermittently, calls made to the Web Service...
2
by: zolof | last post by:
Hi, I am trying to make a simple file updload WinForm app. Here's the code: WebClient webClient = new WebClient(); webClient.UploadFile(new Uri("http://localhost/WebSite/Upload.aspx"),...
2
by: Scott McFadden | last post by:
When I invoke two web service methods sequentially with no delay, the first web method invocation goes smooth while the 2nd one generates the dredded: System.Net.WebException: The underlying...
0
by: DBC User | last post by:
Hello, One of my client reports they are getting "System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly." error suddently from the last week. None...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.