CSS / JS GZip压缩与Asp.Net [英] CSS/JS GZip Compression with Asp.Net

查看:151
本文介绍了CSS / JS GZip压缩与Asp.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在托管的虚拟服务器上,我要为我的Asp.Net 3.5网站启用GZip压缩,我该如何开始?



尝试使用'packed'JS文件,但它们不工作,我假设是因为它们不能正确处理...?

解决方案

GZIP应该由IIS处理


$ b

客户端负责向服务器请求一个GZiped版本。服务器将寻找两件事,请求是http 1.1,以及Accept-Encoding:gzip的头。查找这些标头的简单方法是使用 firebug



IIS6 - 可以使用iis管理单元启用GZip。 Microsoft MSDN

IIS7 - GZip可以通过web.config使用httpCompression xml标签启用 Nick Berardi的获取IIS 7压缩JavaScript



通过缩小和打包javascript文件,通过删除空格和缩短变量名称来减小JavaScript的总大小。


I am currently on a hosted Virtual Server, I want to enable GZip compression for my Asp.Net 3.5 site, how do I go about starting?

I have tried using 'packed' JS files, but they don't work, I am assuming it's because they are not handled correctly...?

解决方案

GZIP should be handled by IIS, what version of IIS are you running?

The client is responsible for asking the server for a GZiped version. The server will be looking for two things, the request is http 1.1, and a header of Accept-Encoding: gzip. An easy way to look for these headers is to use firebug

IIS6 - GZip can be enabled with the iis snap-in. Microsofts MSDN Topic On Gzip With IIS6

IIS7 - GZip can be enabled with the web.config using httpCompression xml tag Nick Berardi's Getting IIS 7 to Compress JavaScript

By minifying and packing javascript files, your decreasing the total size of JavaScript by removing whitespace and shortening your variables names.

这篇关于CSS / JS GZip压缩与Asp.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆