Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
849 views
in Technique[技术] by (71.8m points)

asp.net mvc - MVC2 Website hosted on IIS7 shows directory listing not the Home/Index

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);
    }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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:WindowsMicrosoft.NETFramework64v4.0.30319aspnet_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.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...