locked
How do you set the Timeout value on a System.Data.Services.Client.DataServiceContext RRS feed

  • Question

  • Hi. 

     

    I'm trying to set a timeout on a System.Data.Services.Client.DataServiceContext but it appears the Silverlight version does not have a timeout property. I assume you can get access to the Binding associated with the service contract, but I can't figure out how to do this. Any hints?

    Tuesday, February 8, 2011 12:15 PM

Answers

  • Timeout value is not available on the SL client because there is no synchronous HTTP stack on SL. Instead, you must get the AsyncResult from the Begin...() call and cancel it with DataServiceContext.CancelRequest(ar).

     

    Regards,

    PQ


    Peter Q. http://blogs.msdn.com/peter_qian
    Wednesday, February 16, 2011 9:39 PM
    Answerer

All replies

  • Timeout value is not available on the SL client because there is no synchronous HTTP stack on SL. Instead, you must get the AsyncResult from the Begin...() call and cancel it with DataServiceContext.CancelRequest(ar).

     

    Regards,

    PQ


    Peter Q. http://blogs.msdn.com/peter_qian
    Wednesday, February 16, 2011 9:39 PM
    Answerer
  • Hi,

    The problem is same as the user woodced's question.

    One of my async method is taking about 8 minutes to process, and responds back with some information to be displayed to user. But the Silverlight app throws the credentials dialog exactly after 5 minutes, and the user does not get the information in this case even after entering the username/password. But the process did completed in the server after 8 minutes, and just that user does not get to see the information back from the server.

    Are there any work around to keep the async live for morethan 5 minutes. the dialog comes up exactly after 5 minutes every time i call this async method.

    Thanks in advance.

    Ram

    Friday, March 22, 2013 6:59 PM
  • You can define the following in your app.config

      <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <services>
          <!-- The name of the service -->
          <service name="YourDataServiceName">
            <!--you can leave the address blank or specify your end point URI-->
            <endpoint binding="webHttpBinding" bindingConfiguration="longerTimeout" contract="System.Data.Services.IRequestHandler" />
          </service>
        </services>
    
        <bindings>
          <webHttpBinding>
            <binding name="longerTimeout" sendTimeout="00:10:00" receiveTimeout="00:10:00" />
          </webHttpBinding>
        </bindings>
      </system.serviceModel>

    Tuesday, March 26, 2013 4:13 AM
  • thanks.

    I did set the config to have TimeOuts defined to 30 minutes, but still having the problem.

            <binding name="http" maxBufferSize="104857600" maxReceivedMessageSize="104857600"
    receiveTimeout="00:30:00" sendTimeout="00:30:00" 
    openTimeout="00:30:00" closeTimeout="00:30:00">
            </binding>
    Tuesday, March 26, 2013 10:30 PM
  • Hi PQ,

    But I found that DataServiceContext.BeginExecute() will auto complete after about 60 senconds, even if the server does not return result, and when call EndExecute there will be exception like the screenshot below. I am sure service uri is right, and server side run well but just need about 2minutes to execute the calling. Not sure whether you also encounter this issue? looks like it is caused by beginExecute timeout, but seems no way to update it.


    • Edited by Finnacle Thursday, December 26, 2013 2:43 AM add image
    Thursday, December 26, 2013 2:40 AM