WebService and timeout

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi.

I'm dealing with scenario when call to any web method ends up with timeout and I try to add the user a chance to retry (wait a little bit)
My service proxy code looks like this:

AsyncCallback cb = new AsyncCallback(ServiceCallback);
IAsyncResult result1 = BeginInvoke(methodName, parameters, cb, this);
if(result1.IsCompleted == false)
{
while(true)
{
bTO = result1.AsyncWaitHandle.WaitOne(Timeout, true);
if(bTO == false)//time out occured
{
//display window and ask the user to wait a moment, user press OK when it sure that web method finished
}
if(result1.IsCompleted)
break;
}
object[] ret = EndInvoke(result1);// error every time when time out occured (bTO = false)
}
My scenario is following:
1. BeginInvoke initialize asynch web method call
2. WaitOne waits for Timeout miliseconds
3. WaitOne returns false because timeout occured, and wait screen is displayed. When user close it the web methos is finished.
4. result1.IsCompleted is true so I expect that EndInvoke shall return the results but it throws excpetion "timeout" !!!. Why?
Everything works fine if timeout doesn't occure.

Thanks for any advise
Shark

.



Relevant Pages

  • Re: WebService and timeout
    ... It seems that calling EndInvoke in case earlier timeout occured ends up with TimeOut exception. ... I'm dealing with scenario when call to any web method ends up with timeout and I try to add the user a chance to retry ... BeginInvoke initialize asynch web method call ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: WebService and Timeout
    ... but I try to get the user a possibility to wait another 'timeout'. ... I'm dealing with scenario when call to any web method ends up with timeout and I try to add the user a chance to retry ... Everything works fine if timeout doesn't occure. ...
    (microsoft.public.dotnet.general)
  • Re: WebService and Timeout
    ... Increase timeout value in http-runtime tag in web-config of Web Services ... I'm dealing with scenario when call to any web method ends up with timeout ...
    (microsoft.public.dotnet.general)
  • Re: WebService and timeout
    ... If it is going to time out and you need to get your results before you can go any further, calling it asynchronously isn't going to help any. ... I'm dealing with scenario when call to any web method ends up with timeout and I try to add the user a chance to retry ... Everything works fine if timeout doesn't occure. ...
    (microsoft.public.dotnet.languages.csharp)
  • WebService and Timeout
    ... I'm dealing with scenario when call to any web method ends up with timeout and I try to add the user a chance to retry ... Everything works fine if timeout doesn't occure. ...
    (microsoft.public.dotnet.general)