ASP.NET MVC compression options in IIS6

前端 未结 3 2111
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 16:04

For now I\'m stuck with IIS6 for ASP.NET-MVC (as in I cant upgrade to Server 2008 yet). It doesnt seem to know that my RESTful URLS are dynamic files and isn\'t compressing

3条回答
  •  遥遥无期
    2020-12-29 17:02

    As HTTP compression for ASP.NET usually has been implemented using HttpModules since version 1.0, and HttpModules still belong to the ASP.NET request pipeline used by the MVC framework, you can still use a HttpModule to inject a GZIP or deflate response filter.

    Here you can find a very nice, open-source, ready to ship implementation: HttpCompress by Ben Lowery (download at Google Code)

    You just have to add a reference to the DLL, and add a few lines to your web.config. It already handles very exotic and rare cases and exceptions. You can add exclusions to your web.config, not based on file extensions (like in IIS6), but on mime type, which is probably exactly what you need.

    I should add that I have actually running a ASP.NET MVC website on IIS6 using this library, so I can confirm that this works in practice.

提交回复
热议问题