Windows Server 2008 R2, ASP.NET 4.0, IIS 7+ 64 bit mode issue

Jun 20, 2011 at 12:20 PM
Edited Jun 20, 2011 at 12:25 PM

There seems to be an issue with this component running under the following specification:

1. Windows server 2008 R2
2. IIS 7+
3. ASP.NET 4.0
5. Application Pool Running in 64 bit mode 

The error message received:

HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.

This is down to the fact that either: 

1. Reflection permission on the assembly is denied when getting the calling assembly (should not be the case in full trust environments)
2. The calling assembly passed in not what is expected
3. Something else very weird 

See the following urls for more information.

I initially had to run the application in 32 bit mode to get it to work but with some perseverance I found that if I modified the RegisterUrlFromAttributes method to use the following code it works.

public static void RegisterUrlRoutesFromAttributes(RouteCollection routes)
   // Enumerate assembly for UrlRoute attributes.
   List<MapRouteParams> routeParams = new List<MapRouteParams>();
      .ForEach(assembly => routeParams.AddRange(GetRouteParamsFromAttributes(assembly)));