MVC2 Website hosted on IIS7 shows directory listing not the Home/Index

Rajesh Dhiman picture Rajesh Dhiman · Jan 18, 2014 · Viewed 9.8k times · Source

I am trying to host a MVC2 website to IIS. Steps I have followed:

  1. Create a Website in IIS ( define directory defined physical path and app pool)
  2. Published code from visual studio to the physical path.

But when I tried to browse my site it was giving me error

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

So, I enabled Directory Browsing feature, Now it only shows directory listing. What I have tried?

  1. Added wildcard script map for aspnet_isapi.dll
  2. enabled HTTP Redirection and some other things that I have found on some answers related to this question but nothing worked for me.

My routing configurations are

   public class MvcApplication : System.Web.HttpApplication
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );


    }

    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        RegisterRoutes(RouteTable.Routes);
    }
}

Answer

Darin Dimitrov picture Darin Dimitrov · Jan 21, 2014

Here are the things you might check:

  1. If your application is using ASP.NET 4 ensure that this is registered in IIS. The following command should register it using the aspnet_regiis.exe tool: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis - ir (adapt the paths with the proper version of the framework if necessary).
  2. Ensure that the application pool which is configured for the website is using Integrated pipeline mode.