473,396 Members | 2,011 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,396 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 3463
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.