The Aspnet.config profile _ practical tips for each application pool is set separately in IIS

Source: Internet
Author: User
Tags net thread
After asp.net4.0, this configuration file is fully supported in concurrency and threading. For example, you can set parameters such as MAXCONCURRENTREQUESTSPERCPU, MAXCONCURRENTTHREADSPERCPU, and requestQueueLimit to more flexibly set the configuration of ASP.net runtime.
Copy Code code 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 have allowed different settings to be set individually for each application pool (application pool). The previous asp.net.config can only be used for all the frameworks and not for the site or application pool alone. Now you can rest assured that you can set up a custom Aspnet.config profile for each application pool, and you can save it anywhere on disk, and IIS will load it automatically when the application pool is started.

An article in MSDN that mentions the IIS application pool setting supports a new property clrconfigfile is used to set the configuration for this profile, but defaults to no value, which means that the default is to read only aspnet.config files under the framework root.

IIS Manager (IIS Manager) does not set up a separate UI interface for configuring the application pool, so you must set it manually by using the command. Use Appcmd.exe to set up, refer to the following command-line code, and note the 2 variables (profile path and application pool name).
Copy Code code as follows:

%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 the same, just a template for you to refer to, note that the contents of the curly braces ({AppPoolName} and {FilePath}) are needed 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 under the framework root is still in use, and this customization file is only set up in a different section.
Let's take a look at an example:
Copy Code code 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"/>
</system.web>
</configuration>

With regard to permissions, the application pool uses its own identity to attempt to read the configuration file, and if the file does not have permission, you can use the following code to give the assignment:
Copy Code code as follows:

Icacls c:\inetpub\apppoolclrconfig\defaultwebsite_aspnet.config/grant "IIS apppool\defaultapppool":(R)

For security reasons, make sure that the file does not inherit other permissions or have more permissions.
Now you can set up a custom profile for each application pool individually, and, of course, multiple application pools can share the same custom configuration file. Since the application pool only loads the configuration file when it is started, you will need to restart the appropriate application pool after you have set up the configuration file.
Also, note that this feature only supports IIS7.5 and above, and only Integrated mode (Integrated Pipeline mode) is supported.

For further information, please refer to the link:
    1. <system.web> Application pool settings: http://msdn.microsoft.com/en-us/library/dd560842.aspx
    2. 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
    3. IIS 7.5 Application pool configuration: http://msdn.microsoft.com/en-us/library/aa347554 (vs.90). aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.