使用轮询双工绑定连接多个客户端时,Web服务无响应

时间:2010-09-28 19:10:04

标签: silverlight wcf iis duplex

我有一个启用双工的服务,客户注册自己接收通知。 在同一个AppPool中,我有另一个常规Web服务,客户端使用该服务与服务器通信。向此Web服务发送内容将触发向所有连接的客户端发送通知。 一切正常,直到12,13或更多客户连接。然后,使用双工信道订阅/接收并向其他服务发送内容变得慢得多。 我已禁用asp.net兼容性,并且我的Web服务项目中没有global.asax文件可能触发会话以减慢它。

我的Web服务托管在Windows Server 2008上的IIS7中。 请注意,我的客户端运行SL4,但Web服务托管在.NET 3.5中。

这里有一些来自我的web.config文件的摘录:

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



<pollingDuplexHttpBinding>
    <binding name="pollingDuplexHttpBindingConfig"/>
  </pollingDuplexHttpBinding> 



 <service name="WcfDuplexService.NotificationService"
           behaviorConfiguration="ServiceBehavior">
                            <!-- Service Endpoints -->
                            <endpoint address=""
              binding="pollingDuplexHttpBinding"
              bindingConfiguration="pollingDuplexHttpBindingConfig"
              contract="WcfDuplexService.INotificationService"
              behaviorConfiguration="ServiceFullEndpointBehavior">
                            </endpoint>
                            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
                    </service>




<!-- Message Service -->
  <service name="WcfDuplexService.MessageService" 
           behaviorConfiguration="ServiceBehavior">
    <endpoint binding="customBinding"
              bindingNamespace="http://csintra.net/MessageService"
              contract="WcfDuplexService.IMessageService"
              bindingConfiguration="binaryHttpBinding"
              behaviorConfiguration="ServiceFullEndpointBehavior">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service> 


<serviceBehaviors>
                            <behavior name="ServiceBehavior">
      <serviceThrottling maxConcurrentCalls="1024" maxConcurrentSessions="1024" maxConcurrentInstances="1024" />
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->

      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
                    </serviceBehaviors> 

提前致谢。

1 个答案:

答案 0 :(得分:0)

我们之前有同样的问题。

除了您的配置之外,您刚刚描述的所有内容似乎都很好。您没有在服务的绑定配置中指定不活动超时,打开/关闭超时。请相应地设置它们。你可以检查msdn是否适合你。

在服务时只尝试一个实例。但有多个并发模型。经过负载测试后,我们发现在我们的情况下更好的方法。

对双工服务进行负载测试,在负载测试期间检查性能计数器,查看服务器上发生的情况,RAM /处理器是否有问题。 IIS工作进程是否被暂停?请查看这些东西。

你可以谷歌关于性能计数器。

启用WCF跟踪!!!可能存在一些问题,其中没有弹出。

在您的应用程序中实现自定义跟踪,以查看最新情况。 (可选,但在我们的案例中非常有帮助。)

修改您的双工服务的架构/设计。

阅读有关msdn的WCF双工服务性能指南的指南。 (非常有帮助)

如果要设置并发模式= multi和instance = 1,则启用服务多线程模型。

此致

Mazhar Karimi