WCF Slow response

daniel061974 1 Reputation point
2022-12-26T10:27:39.527+00:00

Hi,
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 ?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,368 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. QiYou-MSFT 4,306 Reputation points Microsoft Vendor
    2022-12-27T12:20:45.867+00:00

    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,   
     UseSynchronizationContext=false)]  
     public class MyService : IInterface{}  
    

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

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

    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.