asynchornous call intermittent 500 server error

  • Thread starter Randy Danielson
  • Start date
R

Randy Danielson

Hello,

I am making an asynchronous call to a web service (not on my local
machine) from a asp.net project that is on my local machine. Then I am
looping and doing a thread sleep while waiting for the
result.IsCompleted.

Intermittantly I get the following error:

A first chance exception of type 'System.Net.WebException' occurred in
system.dll

Additional information: The remote server returned an error: (500)
Internal Server Error.


When I switch back to using the synchronous call I do not seem to have
this problem.

Here is my code that I am using for the asynchronous call:


WebReference.GTSWebOrderSvc webOrder = new WebReference.GTSWebOrderSvc
();
IAsyncResult result = null;
System.DateTime startTime = System.DateTime.Now;

result = webOrder.BeginProcessRequest(this.OuterXml, null, null);
while (!result.IsCompleted)
{
System.Threading.Thread.Sleep(500);
if (startTime.AddSeconds(10) < System.DateTime.Now)
throw new Exception("Request has timed out, web site is
unavailable");
}
return webOrder.EndProcessRequest(result);


I am using
dev environment 2003 ver. 7.1.3088
frame work 1.1 ver 1.1.4322 sp1


Any ideas on what is wrong here?

Thanks

Randy
 

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

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top