The aspnet.config configuration file is set separately for each application pool in iis

  • 2020-05-16 06:45:26
  • OfStack

After ASP.NET4.0, this configuration file is fully supported for concurrency and threading. For example, you can set maxConcurrentRequestsPerCPU, maxConcurrentThreadsPerCPU, and requestQueueLimit parameters to be more flexible in setting the configuration of asp.net runtime.
 
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config 
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config 
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet.config 
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet.config 

In Windows Server 2008 R2 (IIS 7.5), it has been allowed to set different Settings for each application pool (application pool). The previous asp.net.config can only be set for all framework and not for the site or application pool alone. Now you can rest assured that you can set up a separate custom aspnet.config profile for each application pool, and you can save it anywhere on disk. IIS will automatically load it when the application pool starts.

An article in MSDN mentioned that the IIS application pool Settings support a new property, CLRConfigFile, to set the configuration of this configuration file, but by default there is no value, meaning that the default is to read only the aspnet.config file in the framework root directory.

The IIS manager (IIS Manager) does not have a separate UI interface to configure the application pool, so you must manually use the command to set it up. You can set this using appcmd.exe, using the command line code below, noting the two variables (profile path and application pool name).
 
%windir%\System32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /[name='DefaultAppPool'].CLRConfigFile:"c:\inetpub\AppPoolClrConfig\DefaultAppPool_aspnet.config" /commit:apphost 

The following content is also 1, just 1 template for your reference, note that the curly braces ({AppPoolName} and {FilePath}) need to be replaced. (run appcmd under %windir%\System32\inetsrv)
appcmd.exe set config -section:system.applicationHost/applicationPools /[name='{AppPoolName}'].CLRConfigFile:"{FilePath}" /commit:apphost
Note: the aspnet.config file in the framework root directory is still in use. This custom file is only for different Settings.
Let's look at an example:
 
<?xml version="1.0" encoding="UTF-8" ?> 
<configuration> 
<runtime> 
<legacyUnhandledExceptionPolicy enabled="false" /> 
<legacyImpersonationPolicy enabled="true"/> 
<alwaysFlowImpersonationPolicy enabled="false"/> 
<SymbolReadingPolicy enabled="1" /> 
<shadowCopyVerifyByTimestamp enabled="true"/> 
</runtime> 
<startup useLegacyV2RuntimeActivationPolicy="true" /> 
<system.web> 
<applicationPool 
maxConcurrentRequestsPerCPU="5000" 
maxConcurrentThreadsPerCPU="0" 
requestQueueLimit="5000" /> 
</system.web> 
</configuration> 

In terms of permissions, the application pool will use its own identity to try to read the profile. If the file does not have permissions, you can use the following code to give permissions:
 
icacls c:\inetpub\AppPoolClrConfig\DefaultWebSite_aspnet.config /grant "IIS APPPOOL\DefaultAppPool":(R) 

To be safe, make sure that this file does not inherit other permissions or has more permissions.
You can now set a custom profile for each application pool as you wish, or you can share a custom profile for multiple application pools. Since the application pool only loads the configuration file at startup, you will need to restart the appropriate application pool after setting up the configuration file.
Also, note that this feature only supports IIS version 7.5 and above, and only supports integration mode (Integrated Pipeline mode).

For further information, please refer to the following link: < system.web > Application pool Settings: http: / / msdn microsoft. com/en - us/library/dd560842 aspx ASP. NET threads usage: http: / / blogs msdn. com b/tmarq/archive / 2007/07/21 / asp - net - thread - usage - on - iis - 7-0 - and - 6-0. aspx IIS 7.5 application pool configuration: http: / / msdn microsoft. com/en - us library/aa347554 (VS. 90). aspx

Related articles: