c# WCF hosted in a windows service, ConcurrencyMode.Multiple but only using one thread?
===

I have taken my first steps into using WCF for developing a WINDOWS service hosted calc engine. The service is working great but it only ever seems to use one thread for all my calls but I need it to be scalable and use multi-threading.

Ignore all the trace in the code etc as it is VERY early stages of this application folks.

It calls some third party software (COM) that on service start up reads information into memory (ThirdParty.Initialise(strInit)) and then each call to ProcessInformation returns back a calculated results from a given XML string.

So far all calls just seem to use the one thread no matter what I set the ServiceBehavior atts to and no matter how many seperate consumers I use - can anybody help?

Code overview...

    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.PerCall, UseSynchronizationContext = false)]
    public class TestWCFService : ITestWCFService
    {
        private static ThirdPartyLib.ThirdPartyComClass ThirdParty;

        private static bool initCalled = false;
        private static int cntInit = 0;
        private static int cntTrans = 0;

        public TestWCFService()
        {
            if (ThirdParty == null)
            {
                ThirdParty = new ThirdPartyLib.ThirdPartyComClass();
            }
        }


        public bool InitialiseThirdParty(string strInit, out string strError)
        {
            try
            {
                if (!initCalled)
                {
                    cntInit++;
                    ThirdParty.Initialise(strInit);
                    initCalled = true;
                }
                strError = "Call Num " + cntInit;
                return true;
            }
            catch (Exception ex)
            {
                strError = "ThirdParty.Initialise exception " + ex.Message + " 0n call number " + cntInit;
                return false;
            }
        }


        
        public bool ProcessInformation(string strRequestXML, int quoteMarker, out string strResponseXML, out string strError, out int quoteMarkerReturned)
        {
            try
            {
                cntTrans++;
                quoteMarkerReturned = quoteMarker;
                ThirdParty.ProcessInformation(strRequestXML, out strResponseXML);
                strError = "Call Trans Num " + cntTrans;
                return true;
            }
            catch (Exception ex)
            {
                strError = ex.Message + " On call trans num " + cntTrans;
                strResponseXML = "Error";
                quoteMarkerReturned = quoteMarker;
                return false;
            }

        }
    }


        <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.web>
        <compilation debug="true" />
      </system.web>
      <!-- When deploying the service library project, the content of the config file must be added to the host's 
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="TestServiceBinding" bypassProxyOnLocal="true"
              useDefaultWebProxy="false">
              <readerQuotas maxDepth="524288" maxStringContentLength="524288"
                maxArrayLength="524288" maxBytesPerRead="524288" maxNameTableCharCount="524288" />
              <reliableSession inactivityTimeout="00:30:00" enabled="true" />
            </binding>
          </wsHttpBinding>
          <mexHttpBinding>
            <binding name="MEXTestServiceBinding" openTimeout="00:02:00"
              sendTimeout="00:02:00" />
          </mexHttpBinding>
        </bindings>
        <services>
          <service behaviorConfiguration="TestWcfServiceLibrary.TestWCFServiceBehavior"
            name="TestWcfServiceLibrary.TestWCFService">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="TestServiceBinding"
              name="" contract="TestWcfServiceLibrary.ITestWCFService">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="MEXTestServiceBinding"
              contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:8731/Design_Time_Addresses/TestWcfServiceLibrary/TestWCFService/" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="TestWcfServiceLibrary.TestWCFServiceBehavior">
              <!-- To avoid disclosing metadata information, 
              set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="True"/>
              <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" maxConcurrentInstances="100"/>
              <!-- 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="False" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>


