Solve the problem that IIS gzip cannot be enabled normally

Source: Internet
Author: User
Tags vps metabase


1. Download and install gzip

One-click Enable iis gzip method http://www.jb51.net/article/30151.htm on standalone host/VPS

2. After the installation is successful, it is basically possible. Generally, it is the gzip cache directory c: \ windows \ IIS Temporary CompressedFiles directory. We recommend that you store the files on the d disk, and grant all permissions to everyone.

Restart iis.

When Gzip compression is enabled in IIS, OpenFlashChart cannot be properly displayed. Problems and Solutions

When I use the OpenFlashChart control in. NET to display charts, who will think that the chart display is normal or not, is it related to whether Gzip compression is enabled for IIS?
The two sites use the same program. The OpenFlashChart chart of one site is displayed normally, but the other is displayed as "ioerror Error #2032". This problem only occurs in IE6 browser, firefox and IE7 are displayed normally. Why?
Baidu and Google checked that the reason was that Gzip compression was used on the server to optimize the website and no-cache at the same time. The solution was to add an HTTP header to the returned page, the sample code is as follows:

Copy codeThe Code is as follows: Response. Clear ();
// Response. CacheControl = "no-cache ";
// Replace the above sentence with this sentence
Response. AppendHeader ("Cache-Control", "no-cache, no-store, must-revalidate, max-age =-1 ");
Response. Write (chart. ToString (); // output the openflashchat stream
Response. End ();

The following is a detailed description. It is suitable for manual gzip configuration.

1. HTTP compression Overview

HTTP compression is used to transfer compressed text content between Web servers and browsers. HTTP compression uses common compression algorithms such as gzip to compress HTML, JavaScript, or CSS files. The biggest advantage of compression is that it reduces the amount of data transmitted over the network and increases the access speed of the client browser. Of course, it also adds a little load on the server. Gzip is a common HTTP compression algorithm.
This article introduces the HTTP compression method, which is set in Windows, with the advantage of high efficiency.

Ii. How HTTP compression works

How the Web server processes HTTP compression is as follows:
After receiving the HTTP request from the browser, the Web server checks whether the browser supports HTTP compression;
If the browser supports HTTP compression, the Web server checks the suffix of the request file;
If the requested file is a static file such as HTML and CSS, the Web server will check whether the latest compressed file of the requested file already exists in the compressed buffer directory;
If the compressed file of the request file does not exist, the Web server returns the uncompressed request file to the browser and stores the compressed file of the request file in the compressed buffer directory;
If the latest compressed file of the request file already exists, the compressed file of the request file is directly returned;
If the requested file is a dynamic file such as ASPX, the Web server dynamically compresses the content and returns it to the browser. The compressed content is not stored in the compressed cache directory.

I have found a lot of information on the Internet. gzip does not affect the Seo of search engines, and Baidu also makes it clear that Gzip data can be parsed.
We use webmaster tools to check the effect after Gzip:

However, note that GZIP is only effective for Html and other texts, but does not work for compressed images such as gif and jpg.
Download. Here, we will teach you how to open the Gzip of IIS step by step.
1. Open the Internet Information Service (IIS) manager, right-click "website"-"" properties ", and select" service ". In the "HTTP compression" box, select "compressing Application Files" and "compressing static files", and set "temporary directory" and "maximum temporary directory limit" as needed ";

2. In the Internet Information Service (IIS) manager, right-click "Web Service extension"-"Add a new Web Service extension ...", Enter the extension "HTTP Compression" in the "New Web service extension" box and add the "required file" to c: \ WINDOWS \ system32 \ inetsrv \ gzip. dll, the Windows System directory may vary depending on your installation, select "set extension status to allow ";

3. Open c: \ Windows \ System32 \ inetsrv \ MetaBase. xml in a text editor (backup is recommended ),
Note the following before opening:
1. stop IIS before editing MetaBase. xml. You can run: net stop iisadmin with the Microsoft key + R.
2. Restart VPS after modification.

Locate Location = "/LM/W3SVC/Filters/Compression/gzip to set gzip Compression,
Locate Location = "/LM/W3SVC/Filters/Compression/deflate" to set deflate Compression. The above two nodes are next to each other. And set the same attributes.
To Compress dynamic files, set HcDoDynamicCompression to "TRUE",
Add the dynamic file suffix you want to compress in HcScriptFileExtensions, such as aspx;
To Compress static files, set HcDoStaticCompression and HcDoOnDemandCompression to "TRUE",
Add the extension name of the static file to be compressed in HcFileExtensions, such as xml and css;
HcDynamicCompressionLevel and HcOnDemandCompLevel indicate the required compression ratio. The value ranges from 0 to 10. The default value is 0.
HcDynamicCompressionLevel attribute description: HcDynamicCompressionLevel Metabase Property
HcOnDemandCompLevel attribute description: HcOnDemandCompLevel Metabase Property
Note: These two attribute values are generally recommended to be set to 9, with the best cost effectiveness.

Key configuration: GZIP cannot take effect because the following configuration is not mentioned on the Internet.

HcNoCompressionForHttp10 = "TRUE"
HcNoCompressionForProxies = "TRUE"
Change
HcNoCompressionForHttp10 = "FALSE"
HcNoCompressionForProxies = "FALSE"

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.