Search code examples
c#iisasp.net-web-apiwindows-services

How to set maxWorkerThreads for WEBPAI Hosted in Windows service


We have WEBApi (dotnet framework 4.6.1) hosted in windows service.

Now we need to setup maxWorkerThreads and maxIOThreads based on number of cores for performance tuning..

Is it possible to setup this information in app.config file itself? Or Please guide me to right place


Solution

  • You can set these numbers in machine.config file. The path is C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config. Open machine.config file and search <processModel>.

    You will find an item like this:

    enter image description here

    This means that the asp.net framework will automatically configure the asp.net thread parameters for you to handle concurrent requests according to different situations. It is set on a per CPU basis. Default for single CPU is 20/20. So you don't need to set it.

    processModel Element (ASP.NET Settings Schema)