首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WCF wsDualHttpBinding停止发送回调

WCF wsDualHttpBinding停止发送回调
EN

Stack Overflow用户
提问于 2016-04-28 16:35:08
回答 1查看 255关注 0票数 0

我正在开发与计重连接的WCF服务。当权重发生变化时,我们希望向所有连接的客户端发送消息。由于一个计量器只能连接一个客户端,所以我开发了工作流框架,它通过wsDualHttpBinding和回调与客户端进行通信。

此解决方案有效,但在长时间(1-2天)后WCF服务停止发送回调。我知道我的服务是有效的,因为我有记录器--但是我的客户不会收到回调。我的服务也不会抛出异常。

这是我的服务伪多代码

代码语言:javascript
复制
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant, InstanceContextMode = InstanceContextMode.PerSession)]
public sealed class WeightbridgeService : IWeightbridgeService, IDisposable


 public WeightbridgeService()
 {
        this.callback = OperationContext.Current.GetCallbackChannel<IWeightbridgeServiceCallback>();
        weighbridge.WeightChanged += WeightChangedEventHandler;
        timer.Elapsed += TimerOnElapsed;
        timer.Start();
 }

 private void TimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
 {
            timer.Stop();
            this.callback.SendWeightData(this.weightData);
            timer.Start();
 }

和配置

代码语言:javascript
复制
 <bindings>
      <wsDualHttpBinding>
        <binding name="longTimeoutBinding" receiveTimeout="00:45:00" sendTimeout="00:45:00" openTimeout="00:45:00" closeTimeout="00:45:00" >
          <reliableSession inactivityTimeout="00:45:00" />
          <security mode="None"/>
        </binding>
      </wsDualHttpBinding>
    </bindings>

你能帮帮我吗?我哪里做错了?我找不到解决方案。

EN

回答 1

Stack Overflow用户

发布于 2017-02-08 05:04:17

可以在服务配置文件中将receiveTimeout属性添加到绑定中。虽然它的名称是receiveTimeout,但它是服务器用于关闭“非活动”客户端连接的值(时间量)。

示例:

代码语言:javascript
复制
<binding name="wsDualHttpBinding" 
             closeTimeout="00:01:00" 
             openTimeout="00:01:00" 
             receiveTimeout="02:00:00"> <-- this is the amount of time to wait before droppin client connection
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36909372

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档