0

I have an asp.net mvc 2 application which works fine when run from visual studio either in release or debug mode. When the application is deployed to either a remote or local IIS 7 server in release mode it doesn't work.

The error displayed is as follows:

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

Now this is a bit misleading however I have worked out why this error message is being displayed.

  1. The application does not have a default.aspx as this is not needed when running mvc apps on IIS7+

  2. I am using attribute routing which is explained in the link below which uses reflection to build the RouteTable. When interrogating the assembly the attributes are not accessible therefore the RouteTable does not get populated

  3. Since there are no routes the web server attempts to list the directory contents and it does not have permission to do that.

Attribute Routing:

http://itcloud.codeplex.com/

ASP.NET MVC Routing Via Method Attributes

Now my question is what is preventing the application from being able to interrogate the assembly using reflection?

DaTribe

Community
  • 1
  • 1

1 Answers1

0

Lack of ReflectionPermission is a likely cause. Many hosting companies over-restrict permissions. Reflection is one that is often problematic. GoDaddy and RackSpace both restrict it.

What trust level is your application running? What hosting provider are you using? Do you have RDP access?

Lilith River
  • 16,204
  • 2
  • 44
  • 76
  • 1. The application is running in Full Trust (internal) 2. I have RDP acess 3. I am using www.ServerIntellect.com 4. Dedicated Server. –  May 21 '11 at 10:35
  • How do I go about using the reflection permission attribute? –  May 21 '11 at 10:37
  • In full trust you shouldn't need it, but [here is some info on it](http://blogs.msdn.com/b/shawnfa/archive/2005/03/08/389768.aspx). Do you have an error log, or any way to determine if exceptions are being thrown during App_Start? – Lilith River May 21 '11 at 10:40
  • That what I thought, but as it stands this is the apps behaviour. I am having a look at the article. Very interesting read. –  May 21 '11 at 10:57
  • 1
    I have resolved the problem by installing the 32 bit .NET 4.0 framework (aspnet_regiis -i) and setting the application to Enable 32-bit applications. See article http://stackoverflow.com/questions/2659544/cant-run-asp-net-mvc-2-web-app-on-iis-7-5. It seems there is a problem with .NET framework 64 bit mode running on IIS 7+ and windows server 2008 x64 –  May 21 '11 at 11:34
  • I have resolved the problem by installing the 32 bit .NET 4.0 framework (aspnet_regiis -i) and enabling 32-bit applications in the application pool. See article http://stackoverflow.com/questions/2659544/cant-run-asp-net-mvc-2-web-app-on-iis-7-5. It seems there is a problem with .NET framework 64 bit mode running on IIS 7+ and windows server 2008 x64 –  May 21 '11 at 11:40
  • I have found the solution to this problem without have to resort to running the application in 32 bit mode. The routing code needs a slight adjustment. Interrogating not just the calling assembly but all assemblies within the app domain –  Jun 20 '11 at 12:08
  • sorry user181799 can you post the necessary code here? – gidanmx2 Jan 30 '15 at 10:21