Set the Aspnet.config profile separately for each application pool

Source: Internet
Author: User

The version number after asp.net2.0 provides a aspnet.config file under the root folder of each framework. This file is used to configure some information about the whole world, but we haven't used it for a long time.

After asp.net4.0, this configuration file is fully supported in terms of concurrency and threading. For example, you can set maxconcurrentrequestspercpu, maxconcurrentthreadspercpu , and requestqueuelimit and other parameters, For more flexibility in setting up the configuration of the ASP.

C:\windows\microsoft.net\framework64\v4.0.30319\aspnet.configc:\windows\microsoft.net\framework\v4.0.30319\ Aspnet.configc:\windows\microsoft.net\framework64\v2.0.50727\aspnet.configc:\windows\microsoft.net\framework\ V2.0.50727\aspnet.config


In Windows Server R2 (IIS 7.5). has agreed to be able to set different settings for each application pool (application pool) individually, the previous asp.net.config can only be used for the entire framework and cannot be set individually for the site or application pool. Now you can rest assured that you can set up a separate Aspnet.config profile for each application pool, and you can save it anywhere on disk, and IIS will load it on its own when the application pool starts.

An article in MSDN that mentions IIS application pool settings supports a new property clrconfigfile used to set the configuration for this configuration file. However, the default is no value, which means that the default is to read only the Aspnet.config file under the framework root folder.

The IIS Manager (IIS Manager) has not set up a separate UI interface for configuring the application pool, so it must be set manually using commands.

Use Appcmd.exe to set up, for example, the following command line code, note the 2 variables (configuration file 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 the same. Just a template for you to take a look at, note that the contents of the curly braces ({AppPoolName} and {FilePath}) need to be replaced. (Execute 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 folder is still in use. This own definition file is just a different set of parts.

Let's look at a sample:

<?XML version= "1.0" encoding= "UTF-8"?><Configuration>    <Runtime>        <Legacyunhandledexceptionpolicyenabled= "false" />        <legacyImpersonationPolicyenabled= "true"/>        <alwaysFlowImpersonationPolicyenabled= "false"/>        <Symbolreadingpolicyenabled= "1" />        <Shadowcopyverifybytimestampenabled= "true"/>    </Runtime>    <StartupuseLegacyV2RuntimeActivationPolicy= "true" />  <system.web>    <ApplicationPoolmaxconcurrentrequestspercpu= "the"maxconcurrentthreadspercpu= "0"requestQueueLimit= "the" />  </system.web></Configuration>

With regard to permissions, the application pool uses its own identity to attempt to read the configuration file. Suppose this file has no permissions. You can use the following code, for example, to give empowerment:

" IIS Apppool\defaultapppool ":(R)

For security reasons, make sure that the file does not inherit other permissions or has many other permissions.

Now you are free to set up your own defined profiles for each application pool, and of course, multiple application pools can share the same self-defined configuration file. Because the application pool only loads the configuration file when it is started, you will need to restart the corresponding application pool after you have set up the configuration file.

Other than that. It is important to note that this feature only supports IIS7.5 and above version numbers. And only supports Integrated mode (Integrated Pipeline mode).

Set the Aspnet.config profile separately for each application pool

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.