URLRewriter for IIS 7 returns 404 Server Error

asp.nethttp-status-code-404iis-7url-rewriting

I've implemented "Approach 3: Using an HttpModule to Perform Extension-Less URL Rewriting with IIS7" from here:
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

That is based on URLRewriter module:
http://urlrewriter.net/

It seems to work on my local environment but on production server (running IIS 7) it shows "404 – File or directory not found" page.

I've searched on Google and could not seem to find the solution.

In the end, we went back to IIS 6 and followed the instructions here which worked:
http://urlrewriter.net/index.php/support/installation/windows-server-2003

But someday we may have to upgrade to IIS 7 on a shared hosting environment and the same issue will appear again!

Best Answer

The hosting dude got it to work in IIS 7. The HTTP handlers requires wildcard mapping with different application pool to make it work in IIS 7. Hope this helps.

Make sure you have the following in Web.Config:

<system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <handlers>
    <add name="wildcard" path="*" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
  </handlers>
</system.webServer>
Related Topic