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

第二个wcf轮询双工服务调用太长,wcf,silverlight,timeout,pollingduplexhttpbinding,Wcf,Silverlight,Timeout,Pollingduplexhttpbinding,我对WCF服务有奇怪的问题。我使用pollingDuplexBinding和Silverlight客户端。 此代码在web.config中注册了绑定 <bindingElementExtensions> <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex" /> </bi

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

<bindingElementExtensions>
   <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex" />
</bindingElementExtensions>
<system.web>
    <sessionState mode="Off" />
</system.web>
这是客户端代码

        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

<bindingElementExtensions>
   <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex" />
</bindingElementExtensions>
<system.web>
    <sessionState mode="Off" />
</system.web>

这两种方法都可以解决我的问题…

我得到了答案您真的需要AspNetCompatibility吗?如果否-在web.config中将其关闭,还可以为pollingDuplex bindign调整sendTimeout