Set the Aspnet.config profile separately for each application pool

Source: Internet
Author: User

The later version of asp.net2.0 provides a aspnet.config file at the root of each framework, which is used to configure some of the global information, but we haven't used it in any way.

After asp.net4.0, this configuration file is fully supported in terms of concurrency and threading. For example, you can set parameters such as maxconcurrentrequestspercpu, maxconcurrentthreadspercpu , and requestQueueLimit , 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), you have allowed different settings to be set individually for each application pool (application). The previous asp.net.config can only be used for all frameworks and cannot be set individually on a site or application pool. 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 the disk, and IIS will load it automatically 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, but by default there is no value, which means that the default is to read only the Aspnet.config file under the framework root directory.

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 the command line code below, and note the 2 variables (configuration file path and application pool name).

defaultapppool   ']. Clrconfigfile: "  c:\inetpub\apppoolclrconfig\defaultapppool_aspnet.config   " /commit:apphost 

The following is also the same, just a template for you to refer to, note that the contents of 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 under the framework root is still in use, and the customization file is just a different part of the setup.

Let's look at an example:

<?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 try to read the configuration file, and if the file does not have permissions, you can use the following code to give the right:

" 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 custom profiles for each application pool at will, 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, be aware that this feature only supports IIS7.5 and above, and only supports Integrated mode (Integrated Pipeline modes).

Copyright NOTICE: This article for Bo Master http://www.zuiniusn.com original article, without Bo Master permission not reproduced.

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.