Unexpected behavior - getting exception - Underlying connection cl

G

Guest

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.
 
G

Guest

q said:
"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/TerraService.asmx?op=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.
 
A

agapeton

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top