WCF Duplex Service Hangs on 11th Call

I have a WCF duplex service that freezes after magic 10 proxy instances. Specific error on the client:

"System.TimeoutException: this request operation sent to net.tcp: // localhost: 8080 / RoomService / netTcp did not receive a response within the set timeout (00: 00: 59.9960000)."

There are no error messages on the server.

Please note that this is not a standard obvious problem, i.e. Inability to close my proxy connections, as I close each instance of my proxy connection appropriately before opening the following:

try
{
    client.Close();
}
catch (CommunicationException)
{
    client.Abort();
}
catch (TimeoutException)
{
    client.Abort();
}
catch (Exception)
{
    client.Abort();
    throw;
}

And I set the throttle mode to 500 simultaneous actions:

ServiceThrottlingBehavior throttlingBehavior = new ServiceThrottlingBehavior()
{
    MaxConcurrentCalls = 500,
    MaxConcurrentSessions = 500,
    MaxConcurrentInstances = 500
};

I set the ConcurrencyMode of my service to Multiple, and I tried all three possible values ​​for InstanceContextMode.

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

IIS, .

NetTcpBinding, WSDualHttpBinding PollingDuplexBinding ( Silverlight) . BasicHttpBinding WSHttpBinding, .

, ( ), , .

- , . InstanceContext - - -, - .

, 10- , , .

, ?

+3
5

, : , . :

ServiceThrottlingBehavior throttlingBehavior = new ServiceThrottlingBehavior()
{
    MaxConcurrentCalls = 500,
    MaxConcurrentSessions = 500,
    MaxConcurrentInstances = 500
};
base.Description.Behaviors.Add(throttlingBehavior);

10 , .

, , -, . MaxConcurrentXXX 2 ; MaxConcurrentXXX 500. , , , , .

, - - , , , .

+5

, , , .

- ? , , . , ?

0

, .

1) , , .

2) , , :

<behaviors>
    <serviceBehaviors>
        <behavior name="ServiceBehavior">
            <serviceDebug includeExceptionDetailInFaults="True"/>
        </behavior>
    </serviceBehaviors>
</behaviors>

3) ActivityTracing ( Windows SDK), ,

<system.diagnostics>
    <trace autoflush="true" />
    <sources>
        <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
            <listeners>
                <add name="sdt" type="System.Diagnostics.XmlWriterTraceListener" initializeData="Service.svclog"  />
            </listeners>
        </source>
    </sources>
</system.diagnostics>

4) , . , ,

5) HTTP, - http.

6) " WCF Windows" .

0

ServiceBehavior.AutomaticSessionShutdown.

0

OperationContext.Current.Channel.Close();

.

0

Source: https://habr.com/ru/post/1712827/


All Articles