marcusstarnes marcusstarnes - 9 days ago 10
ASP.NET (C#) Question

Url Routing (ASP.NET 4 Web Forms) returning 404 under IIS7 (Win2008) but OK under IIS7.5 (Win7)?

I have an asp.net 4 website that is working fine locally under IIS7.5 (windows 7), and under the Classic Application Pool (albeit .NET 4).

Some of the site uses routing and some of the older sections of the site don't. Anyway, it all works fine locally.

I have just deployed this to our live webserver for the first time since introducing the routing parts of the site, and all I get is 404's for the sections of the site that are using Routing.

The live webserver is IIS7 on Windows 2008, and again is set to use a .NET4 Classic App Pool.

I have tried adding

<modules runAllManagedModulesForAllRequests="true">
under the system.webserver section of my web.config, but this doesn't appear to have made any difference.

Can anyone shed some light on what the problem might be/how to get around this please?

Answer

The only way I've been able to get around this unfortunately is by adding a wildcard script mapping in IIS7 as per this article:

http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-7-integrated-pipeline/

This has at least got the pages routing successfully, even if it does feel a little dirty.