WCF Slow response

daniel061974 1 Reputation point

I have a WCF client . when the response is big (>5MB) , it takes more than an hour to get the response to the client , the CPU is ~40% usage
when I check in Fiddler , I see immediately the response.
How can I do it faster ?

Windows Communication Foundation
Windows Communication Foundation
A Microsoft runtime and set of application programming interfaces in the .NET Framework for building service-oriented applications.
259 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. QiYou-MSFT 851 Reputation points Microsoft Employee

    Hi @daniel061974 ,
    When I was learning about WCF, I saw some examples of improving WCF.
    1.Set ServiceHost on the server to break the maximum number of requests that the ServerHost can receive, such as:
    host.Description.Behaviors.Add(new ServiceThrottlingBehavior()
    MaxConcurrentInstances = 2000,
    MaxConcurrentCalls = 2000,
    MaxConcurrentSessions = 2000
    2. Set the InstanceContextMode and ConcurrencyMode characteristics of the service by using the following features on the class that implements the service contract:

     [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall,  
     ConcurrencyMode = ConcurrencyMode.Multiple,   
     public class MyService : IInterface{}  

    3: Set useDefaultWebProxy="false" in APP.config

    <binding name=""  useDefaultWebProxy="false" />  

    Best Regards
    Qi You

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.