Posts tagged IIS

How to stop IIS7 from handling 404 errors so you can handle them in ASP.NET

IIS7 has lots of places you could look to make this change: you might start off looking to see if it’s an advanced option on your application pool, no, so then you try looking at the web site itself and the option .NET Error Pages.  That has to be it, surely!  So you try every option there Mode=On, Mode=Off, Mode=Remote Only.  Nothing works so you consult the help for those items only learn that “Mode” is to “Select a mode for the error pages: On, Off, or Remote Only.”  You can see now why help writers at Microsoft are so well paid – who would have guessed that Mode = Remote Only sets the Mode to Remote Only!

Now you are really frustrated but luckily you landed on my blog post here where you learned that the true path to 404 happiness is a simple change to your web.config:

<system.webServer>
  <httpErrors errorMode="Detailed" />

404 errors on IIS6 with ASP.NET 4 Beta 2

After installing Visual Studio 2010 and .NET framework 4 on Windows Server 2003 (IIS6) I was getting nothing but 404 errors.  Turns out .NET 4 had somehow been disabled in the IIS metabase.

Here’s the comment I posted to server fault:

Check the metabase.xml file … is there a ’1′ at the start of the line for Framework\V4.0.21006 in WebSvcExtRestrictionList?

I had the same problem and setting it to ’1′ (enabled) cured the problem. ASP.NET 4.0 Beta 1 did not have this problem. The problem only appeared on install of ASP.NET 4.0 Beta 2.

Here’s what it looked like BEFORE fixing the problem:

        WebSvcExtRestrictionList="0,C:\SERVER\system32\inetsrv\httpodbc.dll,0,HTTPODBC,Internet Data Connector                0,C:\Perl\bin\perlis.dll,1,,Perl ISAPI Extension                0,C:\SERVER\system32\inetsrv\httpext.dll,0,WEBDAV,WebDAV                0,C:\Perl\bin\PerlEx30.dll,1,,PerlEx ISAPI Extension                0,C:\Perl\bin\perl.exe "%s" %s,1,,Perl CGI Extension                1,C:\SERVER\system32\inetsrv\asp.dll,0,ASP,Active Server Pages                1,C:\SERVER\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,0,ASP.NET v2.0.50727,ASP.NET v2.0.50727                0,*.exe                0,*.dll                0,C:\SERVER\system32\inetsrv\ssinc.dll,0,SSINC,Server Side Includes                0,C:\SERVER\Microsoft.NET\Framework\v4.0.21006\aspnet_isapi.dll,0,ASP.NET v4.0.21006,ASP.NET v4.0.21006"

And here’s an easier way to change that setting:

http://neilkilbride.blogspot.com/2008/02/windows-2003-iis-returns-404-for-aspnet.html

Shaving seconds off page load times

IIS6 comes with some antiquated settings for Gzip compression.  Even after enabling it in the IIS management console nothing happens until you edit the metabase file to enable the files you really want to compress.
With the correct settings the main page for my site now loads in 5.3s instead of 6.0s and subsequent loads are now down to about 1second with just three requests to the server.
Browser caching and Gzip compression is improving our customer experience significantly now.
Here’s what my metabase settings look like after removing ‘asp’ and adding ‘aspx’, ‘cs’ and ‘js’.
HcFileExtensions=”htm
html”
HcScriptFileExtensions=”aspx
js
css”

Don’t forget to change both sections in the metabase, one for deflate and one for gzip.