在轮询双工 WCF 服务中设置回调超时

发布于 2025-01-04 23:56:01 字数 172 浏览 0 评论 0原文

我有一个带有 CallbackContract 的 WCF 服务。使用“pollingDuplexHttpBinding”将服务公开给 Silverlight 客户端 当 Silverlight 客户端“死机”并且服务调用回调操作时,它会在一分钟后收到超时异常。 我怎样才能将这个超时设置为不同的?

谢谢, 埃拉德

I have a WCF service with a CallbackContract. The service is exposed to a Silverlight client using "pollingDuplexHttpBinding"
When the Silverlight client is "dead" and the service calls a callback operation, it gets a timeout exception after one minute.
How can I set this timeout to be different?

Thanks,
Elad

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一场信仰旅途 2025-01-11 23:56:01

MSDN 中有一篇关于配置 PollingDuplexHttpBinding

//Inactivity timeout
PollingDuplexHttpBinding binding = new PollingDuplexHttpBinding();    
//Get default inactivity timeout
TimeSpan defaultInactivityTimeOut = binding.InactivityTimeout;
//Returns default timeout in minutes: 10
string txtDefaultInactivityTimeOut = defaultInactivityTimeOut.Minutes.ToString();    
//Set new inactivity timeout
TimeSpan newInactivityTimeOut = new TimeSpan(0, 5, 0);
binding.InactivityTimeout = newInactivityTimeOut;

更新:在“如何:为 Silverlight 客户端构建双工服务' 有一个基于 web.config 的示例,配置 PollingDuplexHttpBinding

希望这会有所帮助。

There is a nice article in MSDN related to configuring PollingDuplexHttpBinding:

//Inactivity timeout
PollingDuplexHttpBinding binding = new PollingDuplexHttpBinding();    
//Get default inactivity timeout
TimeSpan defaultInactivityTimeOut = binding.InactivityTimeout;
//Returns default timeout in minutes: 10
string txtDefaultInactivityTimeOut = defaultInactivityTimeOut.Minutes.ToString();    
//Set new inactivity timeout
TimeSpan newInactivityTimeOut = new TimeSpan(0, 5, 0);
binding.InactivityTimeout = newInactivityTimeOut;

UPDATE: Under 'To use PollingDuplexHttpBinding' paragraph of 'How to: Build a Duplex Service for a Silverlight Client' there is web.config based example configuring PollingDuplexHttpBinding.

Hope, this will help.

水溶 2025-01-11 23:56:01

所以看来 PollingDuplexHttpBinding 的“SendTimeout”属性可以完成这项工作:

<extensions>
  <bindingExtensions>
    <add name="pollingDuplexHttpBinding" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement, System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  </bindingExtensions>
</extensions>

<bindings>

  <pollingDuplexHttpBinding>
    <binding name="myPollingDuplex" sendTimeout="00:00:05"/>
  </pollingDuplexHttpBinding>

</bindings>


<services>
  <service name="Kodak.Pgy.Server.Event.WCFService.EventService" behaviorConfiguration="EventBehavior">

    <!--For duplex communication with the service from silverlight client-->
    <endpoint address="/for-silverlight" binding="pollingDuplexHttpBinding" bindingConfiguration="myPollingDuplex" contract="IEventService"/>

  </service>

</services>

So it seems that the "SendTimeout" attribute of PollingDuplexHttpBinding does the job:

<extensions>
  <bindingExtensions>
    <add name="pollingDuplexHttpBinding" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement, System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  </bindingExtensions>
</extensions>

<bindings>

  <pollingDuplexHttpBinding>
    <binding name="myPollingDuplex" sendTimeout="00:00:05"/>
  </pollingDuplexHttpBinding>

</bindings>


<services>
  <service name="Kodak.Pgy.Server.Event.WCFService.EventService" behaviorConfiguration="EventBehavior">

    <!--For duplex communication with the service from silverlight client-->
    <endpoint address="/for-silverlight" binding="pollingDuplexHttpBinding" bindingConfiguration="myPollingDuplex" contract="IEventService"/>

  </service>

</services>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文