Silverlight 4 WCF Ria Service Timeout

2.1k Views Asked by At

I’ve asked this question before without getting to the solution, but since I have done a lot more testing and debugging, and have new information, I figured I would ask again in hopes of getting to the bottom of this once and for all.

My domain service is timing out after 1 minute. I have read all the posts and seen how to create a partial class and explicitly set timeout values, and I have done exactly that, but I still get timed out after one minute. The caveat to this is that after explicitly setting the timeout in my partial class/method, I no longer receive the standard timeout error. Instead I get this:

{System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.<>c_DisplayClass5.b_4(Object sendState) at System.Net.Browser.AsyncHelper.<>c_DisplayClass2.b_0(Object sendState) --- End of inner exception stack trace --- at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)}

Here is my partial class that I set the timeout values in. I have debugged this and know for certain that these values are being set prior to making the call into the service. The service method I am working with is TestTimeout(). It does nothing but sit and wait until the above exception is thrown - exactly one minute after the call.

  public partial class MyDomainContext
  {
    partial void OnCreated()
    {
      var proxy = (WebDomainClient<MyDomainContext.IMyDomainServiceContract>)this.DomainClient;
      proxy.ChannelFactory.Endpoint.Binding.SendTimeout = new TimeSpan(0, 5, 0);
      proxy.ChannelFactory.Endpoint.Binding.ReceiveTimeout = new TimeSpan(0, 5, 0);
      proxy.ChannelFactory.Endpoint.Binding.CloseTimeout = new TimeSpan(0, 5, 0);
      proxy.ChannelFactory.Endpoint.Binding.OpenTimeout = new TimeSpan(0, 5, 0);

    }
  }

My test function on the server:

[Invoke]
public void TestTimeout()
{
  while (true)
  {
    Thread.Sleep(100); // after one full minute, I get the above exception
  }
}

Could something else be timing out? I see the same problem on my local development machine as well as my production server running IIS7. I’m baffled as to what this could be. I don’t think the timeout values are being ignored since I no longer get the standard timeout exception. I just think there is another place that a timeout is happening.

Any ideas?

-Scott

2

There are 2 best solutions below

0
On

This is just a thought, have you tried making your asp.net session timeout explicit, may be its on one minute..

0
On

Try putting this in the constructor of your proxy:

InnerChannel.OperationTimeout = new TimeSpan(24, 0, 0);