0

我有一个启用双工的服务,客户端注册自己以接收通知。在同一个 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> 

提前致谢。

4

1 回答 1

0

我们前段时间有同样的问题。

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

在服务时只尝试一个实例。但具有多个并发模型。在负载测试之后,我们发现它在我们的案例中是更好的方法。

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

你可以谷歌一下性能计数器。

启用 WCF 跟踪!!!可能里面有一些问题没有被弹出。

在您的应用程序中实施您的自定义跟踪以查看发生了什么。(可选,但在我们的案例中非常有帮助。)

修改 Duplex 服务的架构/设计。

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

如果您设置并发模式 = 多且实例 = 1,则启用您的服务多线程模型。

问候,

马扎尔·卡里米

于 2010-10-27T09:55:16.990 回答