WCF service processes only 10 concurrent calls no matter what I do

I understand that there are many questions related to this already, but no matter what I try to do, there seems to be something else in my problem that does not allow any of the other solutions to fix this.

Here's the problem: I have a simple WCF service. It seems to only allow 10 concurrent calls, I need more support. This is regardless of what I installed in my config. maxConcurrentCalls. In this case, to simplify the problem, I don’t even have a real .NET WCF client calling it, I just use a violinist on several machines to release a bunch of HTTP messages to the service. All of them work individually, but I see that they enter 10 at a time. Upon completion, # 1 begins # 11, etc.

My service is a simple “sleep for 30 seconds and return a line” for this example.

Below is my web.config. You can see that I twisted mine maxConcurrentCallsand mine maxConcurrentSessionsmore than the defaults. This does not seem to have any effect, since I still only see 10 simultaneous requests at a time.

What part am I missing to test this to allow more concurrent requests?

Edit: This is hosted in IIS 7.5.

Web.config:   

<configuration>
<system.web>
    <compilation debug="true" targetFramework="4.0" />
</system.web>

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <security>
        <authentication>
            <anonymousAuthentication enabled="true" />
        </authentication>
    </security>
</system.webServer>
<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
                <serviceThrottling 
                    maxConcurrentCalls="32" 
                    maxConcurrentInstances="2147483647" 
                    maxConcurrentSessions="20"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>

Services:

using System;
using System.ServiceModel;

namespace WCFTestService
{
    using System.Diagnostics;
    using System.Threading;

    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
    public class TestService : ITestService
    {

        public string RequestIdentifier { get; set; }

        public int i;

        public string DoWork(string id)
        {
            var secondsBeforeResponding = 20;

            i++;

            this.RequestIdentifier = id;

            Debug.WriteLine("Request: " + id + " Instance:" + i.ToString() + " Thread:" + Thread.CurrentThread.ManagedThreadId.ToString() + " Time:" + DateTime.Now.ToString());

            Thread.Sleep(secondsBeforeResponding * 1000);

            Debug.WriteLine("                                                          Done with request: " + this.RequestIdentifier);

            return "Done with request: " + this.RequestIdentifier;
        }
    }
}

ITestService:

[ServiceContract(SessionMode = SessionMode.NotAllowed)]
public interface ITestService
{
    [OperationContract]
    string DoWork(string requestIdentifier);
}

Conclusion:

Request: b3 Instance:1 Thread:54 Time:4/13/2013 1:50:31 PM <!--- this is the first 10, they all start at pretty much the same time
Request: b4 Instance:1 Thread:47 Time:4/13/2013 1:50:31 PM
Request: b1 Instance:1 Thread:48 Time:4/13/2013 1:50:31 PM
Request: b2 Instance:1 Thread:45 Time:4/13/2013 1:50:31 PM
Request: b5 Instance:1 Thread:44 Time:4/13/2013 1:50:31 PM
Request: b6 Instance:1 Thread:42 Time:4/13/2013 1:50:31 PM
Request: b7 Instance:1 Thread:41 Time:4/13/2013 1:50:32 PM
Request: b8 Instance:1 Thread:39 Time:4/13/2013 1:50:32 PM
Request: b9 Instance:1 Thread:40 Time:4/13/2013 1:50:33 PM
Request: b10 Instance:1 Thread:38 Time:4/13/2013 1:50:34 PM
                                                          Done with request: b3
                                                          Done with request: b4
                                                          Done with request: b1
                                                          Done with request: b2
Request: b11 Instance:1 Thread:35 Time:4/13/2013 1:50:51 PM  <--- this request only starts after the first one finishes
Request: b13 Instance:1 Thread:45 Time:4/13/2013 1:50:51 PM
Request: b14 Instance:1 Thread:54 Time:4/13/2013 1:50:51 PM
Request: b12 Instance:1 Thread:37 Time:4/13/2013 1:50:51 PM
                                                          Done with request: b5
Request: b15 Instance:1 Thread:44 Time:4/13/2013 1:50:51 PM
                                                          Done with request: b6
Request: b16 Instance:1 Thread:42 Time:4/13/2013 1:50:51 PM
                                                          Done with request: b7
Request: b17 Instance:1 Thread:41 Time:4/13/2013 1:50:52 PM
                                                          Done with request: b8
Request: b18 Instance:1 Thread:39 Time:4/13/2013 1:50:52 PM
                                                          Done with request: b9
Request: b19 Instance:1 Thread:40 Time:4/13/2013 1:50:53 PM
                                                          Done with request: b10
Request: b20 Instance:1 Thread:38 Time:4/13/2013 1:50:54 PM
...
...
...
+5
source share
1 answer

You may encounter OS limitations. Try to deploy your service on the server and play it from there.

+5
source

All Articles