繁体   English   中英

第二个WCF轮询双工服务调用太长

[英]Second wcf polling duplex service call is too long

我对WCF服务有奇怪的问题。 我使用pollingDuplexBinding和Silverlight客户端。 绑定是通过web.config中的此代码注册的

<bindingElementExtensions>
   <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex" />
</bindingElementExtensions>

首次通话时一切正常-服务快速返回数据。 但是第二次通话执行了超过5步。 如果我设置了较大的超时,则结果将返回给客户端,否则将引发TimeoutException。 我正在调用的WCF方法不执行任何操作-仅返回短字符串。

WCF跟踪表示,第二次服务调用仅比客户端调用此方法晚5分钟,并且执行迅速。 我使用以下服务属性:

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

这是客户代码

        var binding = new PollingDuplexHttpBinding(PollingDuplexMode.SingleMessagePerPoll);            

        var address = new EndpointAddress("/SportService.svc");
        _proxy = new SportDuplexClient(binding, address);

我有同样的问题,我以这种方式解决:

只需在web.config文件中将aspNetCompatibilityEnabled =“ false”设置为false

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

或在web.config中设置sessionState mode =“ Off”

<system.web>
    <sessionState mode="Off" />
</system.web>

两种方式都可以解决我的问题...

暂无
暂无

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

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