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

Unexpected behavior - getting exception - Underlying connection cl

As per our requirements we have a web service which internally connects
(Simple HTTP Post Request) to a remote server to initiate some work. We are
calling the web service method asynchronously from a .NET Web Application
hosted on IIS. In our setup the web request form a client can be running for
long duration (may be more than 4 hours).

We are getting exceptions during the HTTP send/receive inside the web
service method. The exception are coming only during high load (for instance
when the pending web request count exceeds 45). For each web request the web
service internally do 10 iterations of Http send/receive (each iteration uses
a new Http connection). There is no fixed pattern in the type of exception
raised.

Following exceptions are coming:

1. The underlying connection was closed: An unexpected error occurred on a
receive
Status of Web Exception: ReceiveFailure
2. The underlying connection was closed: An unexpected error occurred on a
send
Status of Web Exception: SendFailure
3. The underlying connection was closed: Unable to connect to the remote
server
Status of Web Exception: ConnectFailure
4. The underlying connection was closed: The request was canceled
Status of Web Exception: RequestCanceled

I am using .NET Framework 1.1
Web Service and web application both are written in .NET and hosted on
Win2003. I had tested replacing web application with windows application but
got no improvement.
I have also observed that number RequestCancled exception has decreased once
we moved our web service form Win2000 Server to Win2003 Server.

I have tried the .NET bug fix by setting *keepalive* to false but still
getting exceptions.

I had modified the .NET config timeout settings to higher values.

<CODE>

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("URL");
webRequest.KeepAlive = false;
webRequest.ProtocolVersion=HttpVersion.Version10;
webRequest.Timeout = timeOut;
webRequest.Proxy = GlobalProxySelection.GetEmptyWebProxy();
webRequest.Method = "POST";
webRequest.ContentType="application/x-www-form-urlencoded";
StreamWriter myWriter = new StreamWriter(webRequest.GetRequestStream());
myWriter.Write("some post Data");
myWriter.Close();
WebResponse httpWebRes = httpWebRequest.GetResponse();
// Do some work with httpWebRes
httpWebRes.Close();

</CODE>

Thanks in advance.

--
Cheers,
Rahul Anand
Mar 28 '06 #1
3 4031
q
"some post Data" isn't a valid SOAP message. Web services communicate
with SOAP messages. You send it proper XML and you will (possibly) get
proper XML back.

Here are samples of what you have to send and what may be returned:
http://terraserver-usa.com/TerraServ...p=GetPlaceList

Mar 28 '06 #2
"q" wrote:
"some post Data" isn't a valid SOAP message. Web services communicate
with SOAP messages. You send it proper XML and you will (possibly) get
proper XML back.

Here are samples of what you have to send and what may be returned:
http://terraserver-usa.com/TerraServ...p=GetPlaceList


The Web Service is working fine and we are getting correct output. The
exceptions are coming during the communication with some other remote server
in our web method.
I think the problem is not directly related to web service. I suspect some
problem in network comminucation may be during heavy load the network
resources are not available or something.

--
Cheers,
Rahul Anand
Mar 28 '06 #3
I think you mean to say "service" then... this is not a web service if
it's not dependent on XML messages (by definition, a web service uses
SOAP XML messages and interop with other web service platforms). I
think you want to be asking about how to deal with exceptions from
HttpWebRequest (which has nothing to do with web services).

Mar 28 '06 #4

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

Similar topics

0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
5
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...
6
by: Yoel | last post by:
Hi, I'm trying consuming web services over SSL by an ASP .Net client without success. System Architecture: My Server side contains the following layers, starting from the client side: ...
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
0
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...
2
by: Andrew Hunot | last post by:
I have VB code in VS2003 which creates a HttpWebRequest and performs a POST operation to a remote URL (an https site), which runs fine and receives a valid response. However exactly the same...
2
by: bevis | last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you...
0
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...
0
by: =?Utf-8?B?T2xpdmllciBHSUw=?= | last post by:
Hello, I try to post an HTTP message containing an XML document, and I get the following exception : System.Net.WebException: The underlying connection was closed: An unexpected error...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
1
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.