473,657 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebClient error: The underlying connection was closed: an unexpected error occurred on a receive

hello,

i am using a .NET 1.1 winform to perform webrequests via the
System.Net.WebC lient class (not a webservice, actually). It uploads
values via a POST command & a URL, then receives the html back. nothing
too complicated there.

except, i am frequently getting the dreaded error:

The underlying connection was closed: an unexpected error occurred
on a receive

....which after some googling, appears to be a .NET bug w/ regards to
open connections actually being closed. this error is typically run
into while working w/ ASP.NET webservers and/or webservices.

i have found many articles instructing one to disable keep-alives, and
using HTTP version 1.0. doing so in this method from the "reference. cs"
seems common:

protected override WebRequest GetWebRequest(U ri uri)
{
HttpWebRequest webRequest = (HttpWebRequest )
base.GetWebRequ est(uri);

webRequest.Keep Alive = false;
webRequest.Prot ocolVersion=Htt pVersion.Versio n10;
return webRequest;
}

....however, i dont know what this "reference. cs" file is.

can anyone provide me w/ the following clues:

- how can i have my WebClient object use a custom WebRequest like the
above?
- can i somehow set the keepalive & http version via the
WebClient.Heade rs collection?
- is this bug perhaps fixed in .NET 2.0 ?

any help would be appreciated!

thanks,
matt

Nov 23 '05 #1
1 6700
The reference.cs file is created via Visual Studios when you add a web
reference to a project. This file is automatically generated for you
that handles the communication between your reference to a webservice
method which is based upon the WSDL (the contract of what the
webservice provides to the world). Hope this helps explain the
reference.cs file for you.

Nov 23 '05 #2

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

Similar topics

1
2968
by: Angel | last post by:
I'm trying to connect to a fixed IP address (eg. http://10.60.903.50/TempFile) in order to retrieve one accii line of text in TempFile. I try to read the information with this code: string fullpath = " http://10.60.93.51/TempFile "; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(fullpath); //req.KeepAlive = false; HttpWebResponse res; StreamReader sr; string strResult = "";
1
8853
by: Fredrik L | last post by:
Hi, We have an application outside the firewall who talks to a webservice inside the firewall. 9 times of 10 this works, but sometimes we got the error "The underlying connection was closed: An unexpected error occurred on a receive." We have tested some of the solutions that we have found in this discussion group but the problem still exist. We use .NET Framework 1.1. The application server use Win2003. The webservice server use...
5
24748
by: Vijayakrishna Pondala | last post by:
Hi, We are using the following error randomly, when accessing a webservice method/servlet hosted on JBoss application server: The underlying connection was closed: An unexpected error occurred on a receive. We are using .NET v1.1.
0
1419
by: tharika | last post by:
Hi, We have an ASP.NET web application hosted on a development server, that invokes web services hosted on an offshore server in India, both being on the same intranet domain. The default page of the application makes a call to a service and is painted successfully. Navigation to any other application page, which invokes the same service throws the error, "Underlying connection was closed. An unexpected error occurred on receive"....
0
1661
by: David Mediavilla | last post by:
I am writing a client for an HTTPS web service using WSE 1.0 but I always get an error like "The underlying connection was closed: An unexpected error occurred on a send." Sometimes the error "occured on a receive". Looking around, I find http://weblogs.asp.net/jan/archive/2004/05/08/128394.aspx ("Solving "The underlying connection was closed" when using WSE"), that sets KeepAlive to false, but it doesn't work for me since when I get to...
0
1570
by: pinky | last post by:
Hi all I am having one web service where in at a time of calling one webmethod through client application i am continuously getting following error :- The underlying connection was closed: An unexpected error occurred on a
0
1236
by: K S | last post by:
All, I am getting the following error when I tried to deploy my webpage (Release Version) on Windows Server 2003. The below error occurs when I try to access the webservice. PS: I can access the webservice from IE from the same Windows Server box. I did some googling and tried the options suggested but with no luck. Any help would be much appreciated.
0
1571
by: Mahesh Devjibhai Dhola | last post by:
Hi, I am getting the following exception when using webservice.. "The underlying connection was closed: An unexpected error occurred on a receive" I am not getting any innerexception so no clue for the reason. While i was seaching on web, i found the solutions but its not working for me. I have already override the method on client proxy but its not working, protected override System.Net.WebRequest GetWebRequest(Uri uri) {
0
2061
by: imonline | last post by:
Hi, I have created a asp.net page which posts XML on the web service using .net 2.0. The page and the webservice was working fine but once I converted them to .net 3.5 I have been getting following exception. And I am having this problem on the local machine that is both of them on same machine. Exception: System.Net.WebException was caught
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.