简体   繁体   中英

WCF PollingDuplex With High Callback Calls cause Service Too Busy Exception for new Service Subscriptions

I currently trying to build a Duplex WCF Service using PollingDuplex Binding with SilverLight 4.0.

My service calls every 1 second few callbacks methods foreach connected clients. However, after 2 client connected, new clients got "Service Located at ... is too busy"

My service use this Behavior :

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, 
    ConcurrencyMode = ConcurrencyMode.Multiple)]

WCF Binding configuration :

<pollingDuplexHttpBinding>
  <binding name="" maxOutputDelay="00:00:01" serverPollTimeout="00:05:00"
    inactivityTimeout="02:00:00" duplexMode="MultipleMessagesPerPoll"
    maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
    maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
      maxArrayLength="2147483647" maxBytesPerRead="2147483647"
      maxNameTableCharCount="2147483647" />
  </binding>
</pollingDuplexHttpBinding>

Service Behavior :

<behavior name="Push">
  <serviceMetadata httpGetEnabled="true"/>
  <serviceDebug includeExceptionDetailInFaults="true"/>
  <serviceThrottling maxConcurrentCalls="2147483647"
    maxConcurrentInstances="2147483647" 
    maxConcurrentSessions="2147483647"/>
</behavior>

Service Definition :

<services>
  <service name="PushService" behaviorConfiguration="Push">
    <endpoint address="" binding="pollingDuplexHttpBinding"
      contract="PushService"/>
    <endpoint address="mex" binding="mexHttpBinding" 
      contract="IMetadataExchange"/>
  </service>
</services>

Any help ? This exception make me crazy !

I noticed that my PollingDuplex-software had limit of 10 clients when using one Internet Explorer. The limitation was still there with Windows 2008 Server R2 machine and Web.config having many settings:

for binding: binding name="pollingDuplexBinding" maxConnections="100"

for serviceBehaviors behaviour: serviceThrottling maxConcurrentCalls="1000" maxConcurrentInstances="1000" maxConcurrentSessions="1000"

and for pollingDuplex maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647"

But then when I tried with different clients:

  • 6 clients on IE on server
  • 6 clients on IE on a different client machine
  • 4 clients on FireFox on this client machine

And it worked. So, there is some kind of limit with same client connections.

I think the issue may be related to “maxconnection” default value 2: from System.Net. Can you try adding following configuration in service and client config and check whether it improves the results,

The above configuration is applied for client application, but remember PollingDuplex is a duplex channel where service behaves as a client for call-back operations.

Please find the beautiful blog by Wenlong which explains why there's requirement for above configuration, http://blogs.msdn.com/b/wenlong/archive/2009/02/08/why-only-two-concurrent-requests-for-load-testing.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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