[WCF]WCF performance testing information share

  • Check the application design for potential synchronous and asynchronous operations
  • Check the application design for WCF binding configurations
  • Determine the optimal service throttling settings for the application
  • Measure the WCF services' ServiceContract (methods) throughput and response times (server and client end)
    • Calls Per Second 
    • Call Duration       
  • Check if the application topology is scaled out by deploying them into a load balanced server farm
  • Execute both end to end and component level performance tests


  • WCF service hosted in IIS (using certificates)
    • In VSTS solution, Add Service Reference to WCF service.  After you enter web address where service is hosted, you see list if services that can be found at the selected web address. Each service might contain multiple service contracts and/or endpoints. The operations displays a list of operations (methods) that are available for each service contract.
    • App.config is added to the solution consisting of service bindings and endpoints
    • If the application uses client certificates, you would install the cert and update the thumprint in the app.config

          <behavior name="ClientCredentialsBehavior">
                <authentication certificateValidationMode="PeerTrust" revocationMode="NoCheck"/>
              <clientCertificate findValue="7e cd 30 4a 60 af 6f e5 e9 03 8f 4e 51 7d 8b bd cd 48 c7 29"
                                 storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>

    • Add "behaviorConfiguration="ClientCredentialsBehavior" tag in each endpoint in the app.config file.  Example:

    <endpoint address="
        binding="wsHttpBinding" bindingConfiguration="SubscriptopnServiceEndPoint" behaviorConfiguration="ClientCredentialsBehavior"
   contract="SubscriptionService.ISubscriptionService" name="SubscriptionServiceEndPoint" />

    • Declare, intialize service client. Populate required data and call service operation. Make sure to close the client in the destructor. Example code:

SubscriptionService.SubscriptionServiceClient subscriptionServiceClient
subscriptionServiceClient = new SubscriptionServiceClient();

purchaseOfferResponse = subscriptionServiceClient.PurchaseOffer(Guid.NewGuid(), sCountryInfo, attributes);

if (null != subscriptionServiceClient)
         if (subscriptionServiceClient.State != System.ServiceModel.CommunicationState.Faulted)

    • When you add this unit test to loadtest, you would need set 'Run unit tests in application domain' to TRUE
  • WCF service hosted in windows services

WCF Performance Counters


Performance Issues

  • Channel timeouts
  • Channel faulting
  • Database deadlocks
  • Throughput and response times violating the performance goals (SLAs)
  • Thresholds crossed for server resource utilization
  • WCF service hosted in IIS: Service behavior when the application pool recycles after default time (29 hours)
Comments (0)

Skip to main content