Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple concurrent WCF calls from single client to Service

Tags:

wcf

I have a service that calls a service on another machine and the most number of concurrent connections I can get is 2. I have tried changing the throttling on the WCF Service Behaviour but to no effect. I have read that it is because of the HTTP limit of 2 concurrent connections from a client machine to a server. How do I overcome this? The os on both machines is server 2003.

Config:

<serviceBehaviors>
    <behavior name="MyServiceTypeBehaviors">
      <serviceMetadata httpGetEnabled="true" />
      <serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"/>
    </behavior>
  </serviceBehaviors>

<system.net>
<connectionManagement>
  <add address="*" maxconnection="100" />
</connectionManagement>

like image 208
Kevin Avatar asked Sep 28 '10 16:09

Kevin


2 Answers

You have to overcome this from client code (from the service which calls other service). Use this code in the initialization of your service application to increase connections:

System.Net.ServicePointManager.DefaultConnectionLimit = 10;
like image 136
Ladislav Mrnka Avatar answered Nov 13 '22 10:11

Ladislav Mrnka


Try adding something like this in your app.config on your client app:

<system.net>
    <connectionManagement>
        <add address="*" maxconnection="100" />
    </connectionManagement>
</system.net>
like image 31
TheNextman Avatar answered Nov 13 '22 12:11

TheNextman