In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article, "what is the method of IIS server and web.config configuration optimization?", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "IIS server and web.config configuration optimization method is what" article.
1. Modify the maximum number of working processes in IIS
a. Please consider the following points:
1. Each worker process consumes system resources and CPU utilization; too many workers will lead to a sharp consumption of system resources and CPU utilization
two。 Each worker process has its own state data, and if a Web application relies on the worker process to save the state data, it may not support the use of multiple worker processes.
3. Competition for resources, allowing multiple worker processes to run the same application will cause competition for resources.
b. Modify the maximum number of worker processes in ISS to improve the performance of the application pool in processing requests
1. In the Web Garden (Web Garden) of IIS 6.0, specifying the number of workers used for an application pool can improve the performance of the application pool in handling requests. When the load of the server is small and no additional working processes are needed, IIS 6.0automatically reduces the actual number of working processes after a certain period of time (default is 20 minutes, configurable); if the load increases, additional working processes are needed, IIS 6.0increases the number of working processes again. All this is done automatically and does not require administrator intervention.
two。 The modification method is as follows:
Modify the configuration of the server. Net framework's machine.config
Directory: C:\ WINDOWS\ Microsoft.NET\ Framework64\ v2.0.50727\ CONFIG\ machine.config
Set the "allowDefinition" value of the "processModel" node to "Everywhere"
Modify the maximum number of iis worker processes in the server:
Method: right-click iis Application Pool-> Properties-> performance tab-> web Garden-> maximum number of worker processes
Note: it is verified by test that when the server has 32 (16'2) cores of 32 GB memory, the setting of 5 has the best performance.
The PS: processModel element (ASP.NET Settings Schema) element configures the processing model for the server, including all ASP.NET applications on the server. Therefore, processModel settings can only be placed in Machine.config files and cannot be overridden by settings in any Web.config file. )
two。 Cancel the web access record of IIS
a. Turning off IIS access records can improve web performance
1.IIS6.0 enables IIS access records for web by default. When logging is enabled, IIS will faithfully record all IIS access records in every detail. The contents of these record files are very complex, such as access time, client IP, which link to access, Cookies, etc., as well as Method (method), UserAgent (user agent) and so on.
These records not only take up a lot of disk space, but also greatly affect the performance of the web server. It has been evaluated that stopping IIS access records can improve web performance by 5 to 8 per cent.
two。 Method: open the IIS manager, navigate to a specific web site, right-click to select "Properties", and uncheck "record access" under the "Home Directory" tab.
Web.config configuration optimization (production environment)
1. Remove useless HttpModules
d. Not all Modules is required. Removing unused HttpModules can speed up requests.
The 1.asp.net default HttpModules management request pipeline controls each request.
For example, SessionStateModule intercepts every request and parses the session cookie to load the appropriate session in the HttpContext. But not all Modules is required, for example: if you do not use membership, you do not need to configure FormsAuthentication module; if you do not use windows authentication, you do not need to configure WindowsAuthentication, these modules are only included in the pipeline, and execute some code that is not necessary for each request.
two。 The default module definition is in machine.config (set in the web.config of the site to indicate that the current site is valid) ($WINDOWS$\ Microsoft.NET\ Framework\ $VERSION$\ CONFIG). If these pipelines are not needed, the configuration is as follows:
The code is as follows:
two。 Turn off the page-level useless mechanism
Node configurations in Web.config globally define page-specific settings, such as ASP.NET directives for pages and controls within the scope of the configuration file. The default enableViewState property is "true", which opens the view. If you do not use this mechanism, you can set it to "false".
The default autoEventWireup property is "true", which opens the page event. If you do not use this mechanism, you can set it to "false".
The default buffer property is "true", which turns on HTTP response buffering.
The default enableViewStateMac property is "false", which turns on running computer Authentication check (MAC) on the view state of the page to place user tampering, which, if set to true, will cause performance degradation.
The default validateRequest is true. There are cross-site scripting attacks and SQL injection vulnerability attacks in validating user input. If a match occurs, a HttpRequestValidationException exception will be issued.
3. Set CustomError to a non-Off state
The nodes in Web.config are used to define some custom error messages. This node has two attributes, Mode and defaultRedirect, where the defaultRedirect attribute is an optional attribute that represents the default URL that the application is redirected to when an error occurs, or displays a general error if it is not specified. The Mode property is a required attribute that has three possible values, which represent the following meanings:
Mode description
On indicates that both local and remote users will see custom error messages.
Off disables custom error messages, and both local and remote users will see detailed error messages.
RemoteOnly indicates that local users will see detailed error messages, while remote users will see custom error messages.
It is necessary to explain the concepts of local and remote users. When the machine we use to access the asp.net application and the machine used to publish the asp.net application are the same machine, we become local users, and vice versa, we call them remote users. In order to find errors in the development and debugging phase, it is recommended to set the Mode property to Off, while in the deployment phase, the Mode property should be set to On or RemoteOnly, so as to prevent these detailed error messages from exposing the details of the program code and causing hackers to invade.
The configuration is as follows:
The code is as follows:
4. Disable debugging
The nodes in Web.config configure all the compilation settings used by ASP.NET. The default debug property is "true", which allows debugging, and there is no problem with this configuration during the development phase. However, after formal deployment, this will affect the performance of the supporting interface, so it should be set to "false" after the program has been compiled and put online.
The configuration is as follows:
The code is as follows:
5. Connection concurrency configuration
The connection concurrency limit is the maximum number of connections initiated to the same domain for the same ip. In fact, this restriction exists in most Microsoft products or components, and the general number is 2 picks and 4, that is, by default, a maximum of 2 connections are established for the same ip to access the same domain. The default is 2, which is too low. This means that each IP can only have up to two requests to your site, which can cause request congestion. The connectionManagement node in asp.net can set the maximum number of connections initiated by a single ip to a domain.
The configuration is as follows:
The code is as follows:
Address stands for which domain,maxconnection represents the maximum number of connections.
6. Remove the ASP.NET version header from the http header information
EnableVersonHeader: specifies whether ASP.NET should output version headers. Use this property to determine which version of ASP.NET is currently in use. For production environments, this property is not required and can be disabled.
Example configuration:
The code is as follows:
The above is the content of this article on "what is the method of IIS server and web.config configuration optimization". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
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.