processmodel and the ASP. NET process Model

Source: Internet
Author: User
Tags configuration settings

Configure the ASP. NET process model settings on the Microsoft Internet Information Services (IIS) WEB server. Its role is to configure the security, performance, robustness, and reliability of application pools (IIS7 and later) in IIS or IIS.

The ProcessModel section can only be set in the Machine.config file, which affects all ASP. NET applications running on the server. The Machine.config file is located in the windows\microsoft.net\framework64\{.net Framework version}\config or windows\ Microsoft.net\framework\{.net the Framework version}\config .

its configuration section content and default settings are as follows, see the role of individual properties can refer to https://msdn.microsoft.com/zh-cn/library/7w2sway1 (vs.80). aspx

Application pools are introduced in IIS6, and the processmodel settings are included in the advanced settings of the application pool. The configuration of the application identity and the settings for IdleTimeout are present in the Machine.config and application pool advanced settings, but are based on the application pool.

If you set username and password in Machine.config,

    < ProcessModel      UserName = "Administrator"     password= "111"/>

View the process by using Task Manager

And the user name of the process is not effective when viewed through the following code

        stringGetprocessusername (intPID) {            stringText1 =NULL; SelectQuery Query1=NewSelectQuery ("Select * from Win32_Process WHERE processid="+PID); ManagementObjectSearcher Searcher1=NewManagementObjectSearcher (Query1); Try            {                foreach(ManagementObject diskinchSearcher1. Get ()) {Managementbaseobject Inpar=NULL; Managementbaseobject Outpar=NULL; Inpar= Disk. Getmethodparameters ("GetOwner"); Outpar= Disk. InvokeMethod ("GetOwner", Inpar,NULL); Text1= outpar["User"].                    ToString ();  Break; }            }            Catch{Text1="SYSTEM"; }            returnText1; } 

However, the settings in the advanced settings of the application pool take effect

Similarly, setting an idle timeout (idleTimeout) is also set to take effect in the application pool, setting the time-out in Machine.config to 1 minutes,

< ProcessModel IdleTimeout = "1" />

set to 2 minutes in the application pool

After visiting the site, notice that the w3wp process disappears in Task Manager, and you will find that the w3wp is closed after two minutes of static.

After observation also found other although not the name of the property, but see its role similar, I did not verify its validity, but also listed

Machine.config-----------Application Pool

================================================

Shutdowntime---------------ShutdownTimeLimit

PingInterval---------------pingfrequency

PingResponseTime------------Pingtimeout

Webgarden---------------maxprocesses set to greater than 1 o'clock

Also , the properties that simply appear in the Machine.config configuration section will take effect, such as whether maxWorkerThreads and Maxiothreads will take effect by looking at the number of threads in the application pool .

Add the following settings in Machine.config.

    < ProcessModel           AutoConfig = "false"          maxworkerthreads= "         maxiothreads"= "999"/>

Add the following code to the Page_Load method of the WebForm page

int Work,io; Threadpool.getmaxthreads (out-out  io);  This string. Format ("<br/> work {0} IO {1}", Work,io);

After running the results are found as follows

here is an additional explanation, if AutoConfig is set to True, it will automatically set maxworkerthreads and maxiothreads, if youwant to use user-defined settings, you need to set to False , the maxWorkerThreads and maxiothreads are the number of worker threads and IO threads in a single CPU, and my computer is a dual core four thread, so the actual result is 4 times times the value of the setting.

About performance in this respect, I refer to a Microsoft article above, after reading summarizes the following points

1. The maxWorkerThreads and maxiothreads of the actual thread pool are in the configuration section

maxworkerthreads*number of CPUs

maxiothreads*number of CPUs

2.minWorkerThreads preferably set to minWorkerThreads = MAXWORKERTHREADS/2

3. the maximum number of requests processed by a single CPU is (Maxworkerthreads*number of CPUs)-minfreethreads,minfreethreads is attribute of the HttpRuntime configuration section

4.If you is making one Web service call to a single IP address from each ASPX page. Microsoft recommends that you use the following configuration settings:

• Set the value of the maxWorkerThreads parameter and the Maxiothreads parameter to .

• Set the value of the maxconnection parameter to *n (N is the number of CPUs ).

• Set the value of the minFreeThreads parameter to *n and minlocalrequestfreethreads parameters of *n.

minworkerthreads is 50

For example, you have a server with four processors and Hyper-Threading enabled. Based on these formulas, use the following values for the configuration settings that are mentioned in this article.

<system.web>  <ProcessModelmaxWorkerThreads= "+"Maxiothreads= "+"minWorkerThreads= " the"/>  <HttpRuntimeminFreeThreads= "704"minLocalRequestFreeThreads= "608"/></system.web><System.Net>  <connectionmanagement>    <AddAddress= "[Provideiphere]"maxconnection= "The "/>  </connectionmanagement></System.Net>

Reference articles

https://support.microsoft.com/zh-cn/kb/821268

Https://msdn.microsoft.com/zh-cn/library/7w2sway1 (vs.80). aspx

Https://www.iis.net/configreference/system.applicationhost/applicationpools/add/processmodel

 

processmodel and the ASP. NET process Model

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.