HttpRuntime and ASP. NET runtime and IIS processing model, httpruntimeasp.net

Source: Internet
Author: User
Tags metabase

HttpRuntime and ASP. NET runtime and IIS processing model, httpruntimeasp.net

Configure ASP. net http runtime settings to determine how to handle requests to ASP. NET applications. The configuration section and its description are as follows.

<HttpRuntime

ExecutionTimeout = "110" -------------------------- specifies the maximum number of seconds allowed to execute a request before it is automatically disabled by ASP. NET.

MaxRequestLength = "4096" -------------------------- specify the input stream buffer threshold (in KB ). This restriction can be used to prevent denial-of-service attacks. For example, a denial-of-service attack caused by a large file being sent to the server.

RequestLengthDiskThreshold = "256" -------------------------- specify the input stream buffer threshold (in bytes ). The value cannot exceed the maxRequestLength attribute.

UseFullyQualifiedRedirectUrl = "false"

MinFreeThreads = "8" -------------------------- minimum number of threads in idle request time and space

MinLocalRequestFreeThreads = "4" -------------------------- minimum number of Idle threads for local requests

AppRequestQueueLimit = "5000" -------------------------- specify the maximum number of requests that ASP. NET will queue for the application. Requests are queued when there are not enough free threads to process requests. When the queue exceeds the limit specified in this attribute, the incoming request is rejected through the "503-server too busy" error message.

EnableKernelOutputCache = "true" -------------------------- enable output cache IIS6 and later versions will take effect

EnableVersionHeader = "true" -------------------------- whether to output the version in the header

RequireRootedSaveAsPath = "true" ------------------------ specifies whether the filename parameter in the SaveAs method must be an absolute path. The ASP. NET process must have the permission to create files in a specified location.

Enable = "true" ------------------------ is equivalent to closing the application (which cannot be accessed even on static pages) and specifying whether to enable the application domain (AppDomain) at the current node and subnode level ), to accept incoming requests. If it is False, the application is actually closed.

ShutdownTimeout = "90" -------------------------- the unit of seconds for disabling the timeout is to specify the number of minutes that can be disabled by the auxiliary process. When the timeout is reached, ASP. NET closes the auxiliary process.

DelayNotificationTimeout = "5" -------------------------- delay notification timeout time in seconds

WaitChangeNotification = "0" -------------------------- pending change notification

MaxWaitChangeNotification = "0" -------------------------- maximum number of pending change notifications

RequestPriority = "Normal" -------------------------- Request Policy

EnableHeaderChecking = "true" -------------------------- enable the header check to detect possible injection attacks. If an attack is detected, ASP. NET returns an error as a response.

SendCacheControlHeader = "true" -------------------------- specifies whether to send the Cache control header set to Private by default. If this parameter is set to True, the client cache is disabled.

ApartmentThreading = "false" ----------- enable unit thread processing to achieve traditional ASP compatibility.

/>

From the above features, it is roughly summarized as the self-running aspect of HttRuntime (including restart time, thread count control, request queue), and request header limiting response output.

HttpRuntime also involves other aspects, such as the Http pipeline and IIS running model. Other blog posts list HttpRuntime, HttpContext, HttpApplication, and each HttpModule in the AppDomain to be processed by HttpHandler after a request arrives.

Dr. Shi's in-depth understanding of the internal operating mechanism of ASP. NET

In addition, I have not carefully figured out the IIS processing model when I look at the Http pipeline. I will also add a supplement here. IIS has reached version 7.0 so far. There are a lot of information on the Internet starting from version 5.0. In this case, we will start from version 5.0 and look at its changes.

The slides are excerpted from Jiang Jinnan's old book ASP. net mvc 4 Framework secrets

IIS5 Processing Model

IIS 5.x runs in the process InetInfo.exe, which hosts a Windows Service named World Wide Web Hing Service (W3SVC. The main functions of W3SVC include HTTP request listening, working processes, and configuration management (by loading related configuration information from Metabase.

If the request is based on ASP.. NET resource type, such. aspx ,. asmx and. svc and so on, aspnet_isapi.dll will be loaded, while ASP. net isapi extension will create ASP. NET (if the process has not been started ). For IIS 5.x, the job process is aspnet.exe. The IIS process communicates with the working process through the Named pipe (Named Pipes.

During the initialization process, the. NET Runtime (CLR) is loaded to build a hosted environment. For the first request of a Web Application, CLR will create an Application Domain for it ). In the application domain, HTTP Runtime is loaded and used to create an application. All Web applications hosted on IIS 5.x run in different application domains of the same process (Working Process aspnet_wp.exe.

IIS6 Processing Model

IIS5 has two drawbacks. One is the separation of ISAPI and working process, which may lead to performance bottlenecks. The other is that all ASP. NET applications exist in the same process and affect applications.

We have made two improvements to these two problems, introducing the application pool and putting the ISAPI into the working process.

In addition, HTTP. SYS is introduced in IIS6 at the system kernel level to handle HTTP requests. The advantage is continuous listening, better stability and data caching in kernel mode. Inetinfo.exe is used to store the configuration information of isapi. w3svcis embedded in another process svchost.exe. Its internal functions have not changed, and the function implementation has been improved.

IIS7 Processing Model

In IIS7, the introduction of Windows Process Activation Service (WAS) is introduced, and some functions of the original (IIS 6.0) W3SVC are distributed to WAS. In fact, the listener is opened with scalable interfaces. W3SVC stores the listening of the original HTTP request, but it also becomes its only responsibility. The subsequent reading of ISAPI information and workflow management will be handed over to WAS. The extended listener interface is useful in terms of WCF, so I don't pay attention to it for the moment. The configuration information of ISAPI does not depend on the original Metabase. Instead, applicationHost. config is used.

The IIS7 integration mode must also be mentioned. The previous introduction to httpHandlers also mentioned that IIS7 has a classic mode and an integration mode. IIS7 used to process Http requests in dual pipelines. There were a bunch of modules in IIS for processing (such as identity authentication), and there were also repeated processing in the Http pipeline. In IIS7, an integrated mode is added to convert the two pipelines into a single pipeline for unified processing. IIS7 also retains the dual-pipeline processing mode, which is called the Classic mode. In Classic mode, the extended HttpModule and HttpHandler only act on the extended resources of ISAPI, but they do not work on static resources. Assume that the integrated mode is used because a single pipeline is used for unified processing, both dynamic and static data are processed by httpModule and HttpHandler.

The preceding IIS processing models are created only when HttpRuntime is within the. NET Runtime range before HttpRuntime is generated. I don't want to paste the Code any more when I call the code. For more information, see "in-depth understanding of the internal operating mechanism of ASP. NET".

All of the above are cloud-based content. After being taught by Feng Ge, I felt that I was not able to study this course. Unfortunately, it seems that there is no effective way to verify these statements. At least no relevant content has been found on MSDN.

Related Article

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.