我执行了以下步骤:
使用 7-ZIP 将 javascript 文件转换为 gzip 文件
在 IIS 中启用静态压缩
更改了 到
使用 firebug 我检查 base.js.gz 响应是否为空。
I performed the following steps:
Converted javascript file to gzip file using 7-ZIP
Enabled static compression in IIS
Changed <script type="text/javascript" src="js/base.js"></script> to <script type="application/x-gzip" src="js/base.js.gz"></script>
<script type="text/javascript" src="js/base.js"></script>
<script type="application/x-gzip" src="js/base.js.gz"></script>
Using firebug I check that base.js.gz response is empty.
不是你这样做的方式。
不用管您的文件,只需在 IIS 中打开静态压缩即可 - 就是这样。
That is not how you do it.
Leave your files alone and simply turn on static compression in IIS - that's it.
您手动压缩文件并使用 IIS。如果你让它工作,它会被压缩两次,这是浏览器无法处理的。
只需使用 IIS 中的压缩功能,它就会即时压缩文件并发送正确的 HTTP 标头,以便浏览器知道要解压缩它。
You are both compressing the file manually, and using IIS. If you got that to work, it would be compressed twice, which the browser can't handle.
Just use the compression in IIS, it will compress the files on the fly and send the correct HTTP header so that the browser knows to decompress it.
我认为你需要重新考虑你的方法。为了在 IIS7 中启用静态文件类型的 gzip 压缩内容,您需要在 web.config 中执行以下操作:
<system.webServer> <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <staticTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> </staticTypes> </httpCompression> <system.webServer>
I think you need to rethink your approach. In order to enable gzipped content for static filetypes in IIS7 all you need is this in web.config:
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(3)
不是你这样做的方式。
不用管您的文件,只需在 IIS 中打开静态压缩即可 - 就是这样。
That is not how you do it.
Leave your files alone and simply turn on static compression in IIS - that's it.
您手动压缩文件并使用 IIS。如果你让它工作,它会被压缩两次,这是浏览器无法处理的。
只需使用 IIS 中的压缩功能,它就会即时压缩文件并发送正确的 HTTP 标头,以便浏览器知道要解压缩它。
You are both compressing the file manually, and using IIS. If you got that to work, it would be compressed twice, which the browser can't handle.
Just use the compression in IIS, it will compress the files on the fly and send the correct HTTP header so that the browser knows to decompress it.
我认为你需要重新考虑你的方法。为了在 IIS7 中启用静态文件类型的 gzip 压缩内容,您需要在 web.config 中执行以下操作:
I think you need to rethink your approach. In order to enable gzipped content for static filetypes in IIS7 all you need is this in web.config: