Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

4 Answers 4

up vote 1 down vote accepted

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

share|improve this answer
    
Great Code Snippet! I'm going to try it and if it doesn't work, try HttpCompress. I think this is exactly what I'm looking for though! –  Armstrongest Jun 18 '09 at 23:08

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.

share|improve this answer
    
Thanks! I will definitely Try this! –  Armstrongest Jun 18 '09 at 23:01

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.
share|improve this answer
    
That's basically what I'm doing, yes. That turns on file compression for IIS (I'm using IIS 6, btw) for those extensions for ALL sites. Other sites ARE working. Just the one that serves Extensionless URLs is not working –  Armstrongest Jun 10 '09 at 20:20
    
You may try this way. It worked on our IIS 6.0 –  Mathieu Chateau Jun 10 '09 at 21:57
    
Thanks. I think it has to do with the extensions. IIS6 doesn't compress extensionless files, which is what routing is. –  Armstrongest Jun 18 '09 at 23:02

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.