简体   繁体   English

Silverlight 4 WCF Ria服务超时

[英]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. 我的域服务在1分钟后超时。 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:远程服务器返回错误:NotFound。 ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException:远程服务器返回错误: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)} 在System.Net.Browser.BrowserHttpWebRequest的System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult)处。在System.Net.Browser.AsyncHelper。<> c_DisplayClass5.b_4(Object sendState)处。 -内部异常堆栈跟踪的结尾--在System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)在System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod,Object state)在System.ServiceModel.Channels。 HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult结果)}

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(). 我正在使用的服务方法是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. 我在本地开发计算机以及运行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会话超时明确,可能只是一分钟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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