IIS ASPnet HTTP compression and Ajax

Source: Internet
Author: User
Recently, I am working on the IIS ASPnet project, which requires a high access speed on the homepage.
By configuring the apppool, You can effectively improve the IIS response speed.
After HTTP compression is enabled for IIS Program Processing and Ajax calls produce problems.
The HTTP compression configuration of IIS is relatively simple and cannot be easily obtained.
I found blowery. Web. httpcompress (online documentation), which has a good performance rating.

Configuration
Web. config
<Configsections>
<Sectiongroup name = "blowery. Web">
<Section name = "httpcompress" type = "blowery. Web. httpcompress. sectionhandler, blowery. Web. httpcompress"/>
</Sectiongroup>
</Configsections>

Blowery. Web
<Blowery. Web>
<Httpcompress preferredalgorithm = "gzip" compressionlevel = "high">
<Excludedmimetypes>
<Add type = "image/JPEG"/>
<Add type = "image/GIF"/>
<Add type = "text/plain"/> <! -- Solve the problem that AJAX callback does not support compression formats -->

</Excludedmimetypes>
<Excludedpaths>
<Add Path = "nocompress. aspx"/>
</Excludedpaths>
</Httpcompress>
</Blowery. Web>

Excludedmimetypes contained in this mime type will not be compressed
Excludedpaths The contained aspx will not be compressed

Note: Source code A bug excludepaths does not work.
String realpath = "";
Try
{
Logger. debug (App. Request. applicationpath );
Realpath = app. Request. Path. Remove (0, app. Request. applicationpath. Length );
}
Catch (exception ex)
{
Logger. debug (ex. Message );
Realpath = "/";
}

After testing, a 35 K page can be controlled at 10 ~ 15 K size, which greatly speeds up transmission.
The overall effect is good.

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.