After ASP. NET4.0, this configuration file is fully supported in terms of concurrency and threads. For example, you can set parameters such as maxConcurrentRequestsPerCPU, maxConcurrentThreadsPerCPU, and requestQueueLimit to configure asp.net runtime more flexibly.
Copy codeThe Code is as follows:
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), you can set different settings for each application pool. config can only act on all frameworks, but cannot be set separately for the site or application pool. Now you can rest assured that you can set a custom aspnet for each application pool. config configuration file, and you can save it anywhere on the disk. When the application pool is started, IIS will automatically load it.
An article in MSDN mentions that when setting IIS application pool, CLRConfigFile supports a new attribute to set the configuration of this configuration file, but it does not have a value by default, that is to say, by default, only the aspnet under the framework root directory is read. config file.
The IIS Manager does not set a separate UI for configuring the application pool. Therefore, you must use commands to set the UI manually. You can use appcmd.exe to set it. For more information, see the following command line code. Note the two variables (configuration file path and application pool name ).
Copy codeThe Code is as follows:
% Windir % \ System32 \ inetsrv \ appcmd.exe set config-section: system. applicationHost/applicationPools/[name = 'defaultapppool ']. CLRConfigFile: "c: \ inetpub \ AppPoolClrConfig \ defaappapppool_aspnet.config"/commit: apphost
The following content is the same. It is just a template for your reference. Note that the content ({AppPoolName} and {FilePath}) in curly brackets must 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 under the framework root directory is still in use. This custom file is only used to set different parts.
Let's look at an example:
Copy codeThe Code is as follows:
<? 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" type = "codeph" text = "codeph"/>
</System. web>
</Configuration>
With regard to permissions, the application pool will use its own identity to try to read this configuration file. If this file does not have permissions, you can use the following code to grant permissions:
Copy codeThe Code is as follows:
Icacls c: \ inetpub \ AppPoolClrConfig \ DefaultWebSite_aspnet.config/grant "iis apppool \ defaappapppool" :( R)
For security, make sure that this file does not have other permissions or has more permissions.
Now, you can set custom configuration files for each application pool. Of course, multiple application pools can also share the same custom configuration file. Because the application pool only loads the configuration file when it is started, you need to restart the corresponding application pool after setting the configuration file.
In addition, note that this function only supports IIS7.5 and later versions, and only supports the Integrated Pipeline mode ).
For more information, see the link:
- <System. web> application pool settings: http://msdn.microsoft.com/en-us/library/dd560842.aspx
- ASP. NET thread 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