In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
How to talk about the application of ASP.NET, I believe that many inexperienced people do not know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
When a request arrives, it is routed to the ISAPIRuntime.ProcessRequest () method. This method calls the HttpRuntime.ProcessRequest method, which does something important (look at the System.Web.HttpRuntime.ProcessRequestInternal method with Reflector):
◆ creates a new HttpContext instance for the request
◆ gets a HttpApplication instance
◆ calls the HttpApplication.Init () method to set the event of the pipe
The ◆ Init () method triggers the HttpApplication.ResumeProcessing () method that starts ASP.NET pipeline processing.
ASP.NET application is introduced. First, a new HttpContext object is created and used to pass ISAPIWorkerRequest (wrapper for ISAPI ECB). This context is always available throughout the life cycle of the request and can always be accessed through the static property HttpContext.Currect. As the name implies, the HttpContext object represents the context of the current active request because it contains all the typical important objects you need to access during the request life cycle: Request,Response,Application,Server,Cache. HttpContext.Current gives you the ability to access all of these at any time during request processing.
The HttpContext object also contains a very useful Items collection that you can use to save data for specific requests. The context object is created at the beginning of the request cycle, released at the end of the request, and all data saved in the Items collection is available only in this particular request. A good example of use is the request log mechanism, when you want to record the start and end time of the request by attaching the Application_BeginRequest and Application_EndRequest methods in Global.asax (as shown in listing 3). HttpContext is very useful to you-if you need data in different parts of the request or page processing, you are free to use it.
Protected void Application_BeginRequest (Object sender, EventArgs e) {/ / * Request Logging if (App.Configuration.LogWebRequests) Context.Items.Add ("WebLog_StartTime", DateTime.Now);} protected void Application_EndRequest (Object sender, EventArgs e) {/ / * Request Logging if (App.Configuration.LogWebRequests) {try {TimeSpan Span = DateTime.Now.Subtract ((DateTime) Context.Items ["WebLog_StartTime"]); int MiliSecs = Span.TotalMilliseconds / / do your logging WebRequestLog.Log (App.Configuration.ConnectionString,true,MilliSecs);}
Once the context is set, ASP.NET needs to route the received request to the appropriate application / virtual directory through the HttpApplication object. Each ASP.NET application must be set to a virtual directory (or Web root) and each "application" must be processed separately.
The HttpApplication is similar to the host of the ceremony-it is the place where the action begins.
Domain owner: HttpApplication
Each request is routed to a HttpApplication object. The HttpApplicationFactory class creates a pool of HttpApplication objects for your ASP.NET application based on the load of the application and distributes a reference to the HttpApplication object for each request. The size of the object pool is limited by the MaxWorkerThreads setting in the process Model key in the machine.config file. The default is 20. According to the code decompiled by Reflector, the size of the pool should be 100. if the size of the pool is less than 100, HttpApplicationFactory will create more than 100, but considering that multiple threads will create HttpApplicationFactory at the same time, there may be more than 100.
After reading the above, have you mastered how to talk about the application of ASP.NET? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.