locked
Async Web Service TimeOut

    Question

  • I have a windows client application that calls a asmx web service asynchronously. Most of the time this works fine.  But I have a user occasionally running into the issue where the completed event throws a System.Timeout exception. The server continues running and completes the operation.

    The httpruntime execution timeout is 1800, which is definitely not getting hit.  It's almost like the callback is timing out.  I am trying to figure out where exactly to look.

    I know the service proxy has a Timeout property, but I've read this is only for calling the service synchronously.  Please correct me if I'm wrong. 

    Here is what the stack trace looks like.

    Server stack trace: 
      at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
      at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
      at System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
      at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    
    Exception rethrown at [0]: 
      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
      at [MyApp].[Service].[SoapClient].End[Method](IAsyncResult result)
    Any advice in hunting down this error is appreciated.

    Thanks.

    Monday, May 09, 2011 8:54 PM

All replies

  • This bit me as I was throwing code together. Make sure you are not leaving a data connection open. The web service handles it perfectly, but the application was causing a timeout issue with the pool. Make sure you are closing readers and connections. It did not make sense to me, but as soon as my code error came into vision in the webservice, and I fixed it. The application pool error was fixed.
    Tuesday, May 10, 2011 2:20 PM
  • This service does a lot of file manipulation (moving across the LAN, deleting, renaming) and I've gone through a lot to make sure everything is handled appropriately.  I can't recreate the error and the user encounters the error only on occasion.

    I wonder if the proxy Timeout, while not affecting the actual asynchronous call, still affects the callback to see if it is complete. 

    That's my only guess, but I don't want to push out a new release with a "fix" that I'm not sure will work.


    Tuesday, May 10, 2011 5:15 PM
  • Yikes......I hate these errors. Because it happens on occasion, I would lean that one of the items is not being handled, but since it sounds like a large application it might be a bear to isolate the real error. I suggest using some trap logging to attempt to isolate the error.

    You can increase the app pool, but everywhere I saw, it warned about this because most of the time it is a bandage for an internal bleeder.

     

    Good Luck,

    Fred

    Tuesday, May 10, 2011 5:26 PM
  • Well I have a bit more detail on the error.  Hopefully the new bits of this click to someone.

     

    Exception Message:
    The HTTP request to 'https://<www.mycompany.com>/<service>.asmx' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.
    
    Inner Exception Message:
    The request was aborted: The request was canceled.
    
    Exception StackTrace:
    
    Server stack trace: 
      at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
      at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
      at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
      at System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
      at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    
    Exception rethrown at [0]: 
      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
      at <Application>.<Service>.<ServiceSoap>.End<Method>(IAsyncResult result)
      at <Application>.<Service>.<ServiceSoapClient>.<Application>.<Service>.<ServiceSoap>.End<Method>(IAsyncResult result)
      at <Application>.<Service>.<ServiceSoapClient>.End<Method>(IAsyncResult result)
      at <Application>.<Service>.<ServiceSoapClient>.OnEnd<Method>(IAsyncResult result)
      at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
    
    Inner Exception StackTrace:
      at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
      at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
    

    Wednesday, May 11, 2011 5:32 PM
  • Its just wierd.  I can't find any timeouts that default to 1 minute.  I do have a WCF service on the same web application that has open/close timeouts of 1 minute, but I don't see why that binding would be affecting a separate asmx service.
    Wednesday, May 11, 2011 6:07 PM
  • One more note.  This doesn't seem to be the same error as before even though no changes were made. Before, the server would continue and complete the server side work even though the client would error due to the exception.

    Following the logs from IIS, previously the server returned a 200 code on the request.  Now with this latest error, the server returned a 500 error and no work was done on the server.

    Comparing the stack trace in my first post, vs. the trace in my latest post, the earlier errored during the "ServiceChannel.HandleReply" method and now it errors during the "AsyncResult.End[TAsyncResult]" method.

    I didn't have an exception message on the first exception because the logging was different.  I gave the user a client with slightly better logging to get the exception/inner exception info.

    I upped my server side trace logging to Warning on top of the Error that I had it set to.  I hope this provides even more detail.

    Wednesday, May 11, 2011 6:41 PM