简体   繁体   中英

Silverlight 4 WCF Ria Service Timeout

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

尝试将其放在代理的构造函数中:

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

这只是一个想法,您是否尝试过使asp.net会话超时明确,可能只是一分钟。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM