3

I haven't seen any questions specifically addressing this specific issue.

When URL Routing is used, The Request goes into IIS and then is routed to the Aspx Page. For example, a site: www.site.com/products may route the request to wwwroot/inetpub/mysite/pages/productsPage.aspx

It's important to note that the page is ROUTED, not ReDirected.

Note that to get the URLs to work properly in IIS 6, a Wildcard extension has to be set up which routes all resources to Asp.Net (Asp.Net will then hand static resources back over) This is documented here: http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/

It would appear that IIS doesn't GZip the content when it sends it back. I have followed the instructions here: http://www.kavinda.net/2007/02/17/how-to-enable-http-compression-iis6.html

to enable IIS 6 compression.

Any idea why Http Compression doesn't seem to work? It seems to work fine on other sites on my server. Just the one with URL Routing isn't working

4 Answers4

1

Make your ASP.NET application gzip its output itself with a method like this one.

crb
  • 8,026
1

Best thing to do is use HttpCompress by Bel Lowery. It's a simple, free and open source HttpModule handling the HTTP compression of your pages. You can use it in combination with the IIS Http Compression option.

I use HttpCompress in combination with Vici MVC and it works smooth!

I've been searching the net for hours and it was either use HttpCompress, buy a commercial project (Port80 Software has a solution) or write my own HttpModule.

PS: IIS does HTTP compression based on the file extension. That's why it's not working for websites using URL routing.

Niels R.
  • 255
0

Did you try this way ? MS KB322603

To enable IIS 5.0 to compress .aspx pages, follow these steps:

  1. Open a command prompt.
  2. Type net stop iisadmin, and then press ENTER.
  3. Type cd C:\InetPub\adminscripts, and then press ENTER.
  4. Type the following, and then press ENTER: CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
  5. Type the following, and then press ENTER: CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
  6. Type net start w3svc, and then press ENTER.
0

Sorry to be that late on the discussion, but since I (still) have to enable IIS 6 compression on a MVC site, here is an IIS 6 native solution I have found: Include in compressed extensions axd. This suppose you have IIS 6 extension less URLs support from .Net framework 4 correctly enabled.

I have done that directly in IIS Metabase. (As explained here; %windir%\systems32\inetsrv\metabase.xml. Prior to edit it, stop IIS or enable "metabase hot editing" in IIS, and backup it.)

Extract from my configuration:

<IIsCompressionScheme   Location ="/LM/W3SVC/Filters/Compression/deflate"
    HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
    HcCreateFlags="0"
    HcDoDynamicCompression="TRUE"
    HcDoOnDemandCompression="TRUE"
    HcDoStaticCompression="TRUE"
    HcDynamicCompressionLevel="9"
    HcFileExtensions="htm
        html
        txt
        xml
        css
        js"
    HcOnDemandCompLevel="10"
    HcPriority="1"
    HcScriptFileExtensions="asp
        dll
        exe
        cgi
        aspx
        asmx
        ashx
        axd"
>
</IIsCompressionScheme>
<IIsCompressionScheme   Location ="/LM/W3SVC/Filters/Compression/gzip"
    HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
    HcCreateFlags="1"
    HcDoDynamicCompression="TRUE"
    HcDoOnDemandCompression="TRUE"
    HcDoStaticCompression="TRUE"
    HcDynamicCompressionLevel="9"
    HcFileExtensions="htm
        html
        txt
        xml
        css
        js"
    HcOnDemandCompLevel="10"
    HcPriority="1"
    HcScriptFileExtensions="asp
        dll
        exe
        cgi
        aspx
        asmx
        ashx
        axd"
>
</IIsCompressionScheme>
<IIsCompressionSchemes  Location ="/LM/W3SVC/Filters/Compression/Parameters"
    HcCacheControlHeader="max-age=86400"
    HcCompressionBufferSize="8192"
    HcCompressionDirectory="%windir%\IIS Temporary Compressed Files"
    HcDoDiskSpaceLimiting="TRUE"
    HcDoDynamicCompression="TRUE"
    HcDoOnDemandCompression="TRUE"
    HcDoStaticCompression="TRUE"
    HcExpiresHeader="Wed, 01 Jan 1997 12:00:00 GMT"
    HcFilesDeletedPerDiskFree="256"
    HcIoBufferSize="8192"
    HcMaxDiskSpaceUsage="99614720"
    HcMaxQueueLength="1000"
    HcMinFileSizeForComp="1"
    HcNoCompressionForHttp10="FALSE"
    HcNoCompressionForProxies="FALSE"
    HcNoCompressionForRange="FALSE"
    HcSendCacheHeaders="FALSE"
>
</IIsCompressionSchemes>

Rational: under the hood, extension less URLs work in IIS 6 by calling an eurl.axd page. See this blog for a more in depth explanation on extension less URLs in IIS6 with fx4.