We all know that different deployment methods have an impact on the performance of the site. Some friends may already know this. In any case, let's talk about this problem in detail, the right of a familiar friend should be reviewed by J.
Release compilation Project
If our Project is created using the Project method, that is, our site is included in a Solution, the release method is used for Project compilation before release, this method reduces the CPU usage. Due to the release in debug mode, the compiler adds a lot of information to the compiled code, such as debugging information.
Procedure:
1. In VS, select "Build | Configuration Manager" as follows:
2. In the "Active Solution Configuration" drop-down box, click "Release" and then "Close". Then, Solution is compiled in Release mode. (In fact, there are many ways to compile Solution into Release. For example, you can right-click "attribute" on Solution and set it)
Although Solution is the Release method, if we check the config file of the ASP. NET Site program under this Solution, we find that the Solution is the deubg method. When releasing a site, we need to manually change it to release.
NOTE: If Solution is compiled in debug mode, even if web. config sets release, the code of the last released site is still in the form.
Site Publishing
The procedure for publishing is as follows:
1. Modify the web. config configuration as follows:
2. Right-click the site and choose Publish as follows:
Reduce Unnecessary Backhaul
We all know that it takes a certain amount of time to return data from the server end to the client end, and the user's waiting time is extended. Therefore, some backhaul requests are optional and free of charge.
Server. Transfer Vs Response. Redirect
If we need to direct users to another page on the Server side, consider using Server. Transfer instead of Response. Redirect.
When Response. Redirect is used, the server will send a Response to the browser of the Client: Tell the browser to load the page to which the redirection is sent. Then the browser sends the request to the server again to request another page.
When we use Server. Transfer, the Server immediately performs a jump. A bad thing to do is: A. aspx is requested at this time. In fact, the server has already jumped to the B. aspx page, but the Url on the browser still shows A. aspx.
When using Server. Transfer, you must note that Server. Transfer is used when you are sure to jump to page B every time you access page. For example, if you want to comment on an article you are reading when you are not logged on to the blog, the page will jump to the Login page. After logging on, the page jumps to the page where the previous article was read, and then writes a comment. At this time, this jump is not suitable for Server. Transfer, but for Response. Redirect. If a user is always redirected to a fixed page no matter where the user is, as long as the user logs on, Server. Transfer can be used.
In addition, Server. Transfer consumes resources on the Server after all. Pay attention to this when using it.
We can see from the above: tuning is a compromise process, not an absolute one. The final optimization is "time-space conversion-time-for-space and space-for-time ".
Declare the site's default page
When we request a site, such as a http://www.bkjia.com, IIS automatically redirects some to the http://www.bkjia.com /. At the same time, http. sys will not add the default homepage of the site without a declared homepage to the kernel cache (which may be a bit of a wrap). For example, if you are in a program, we set the Default page of the site to Default. aspx, but we did not configure Default when deploying to IIS. aspx is the default page of the site, so the content of this page will not be http. sys is cached in the kernel. To avoid IIS redirection and allow http. sys cache page, we want to configure the site's default page in IIS (or enter http: // http://www.bkjia.com/default each time in the browser. aspx, but we cannot control user behavior, so this is almost impossible)
Always jump to related topics
If a page on our site expires or is no longer used, we can use 301 to redirect permanently. When the server sends a 301 response to the client, both the browser and proxy update their cache (if the previous old page uses a cache) and the search engine uses a new page.
To allow the server to send a 301 response to the client, follow these steps:
1. Code:
ASP. NET 4.0 and later versions:
Response. RedirectPermanent ("NewPage. aspx ");
2. IIS configuration
A) IIS 6 Configuration
1. on the IIS Site, select the file or directory you want to jump.
2. Select "A redirection to a URL"
3. Enter the page you want to jump.
4. Select "The exact url entered above" and "A permanent redirect for this resource ".
B) IIS 7
On Server 2008
1. Choose Start> Administrative Tools> server management"
2. Add "role service" to IIS"
3. Under "common Http functions", select "Http redirection"
4. Install the SDK.
On Windows 7 7, as follows:
Then, configure web. config on our site as follows:
1. <configuration>
2. <location path = "OldPage. aspx">
3. <system. webServer>
4. 5. </system. webServer>
6. </location> 7. </configuration>
This is an excerpt from my blog