IIS7 上托管的 MVC2 网站显示目录列表而不是主目录/索引 [英] MVC2 Website hosted on IIS7 shows directory listing not the Home/Index

查看:19
本文介绍了IIS7 上托管的 MVC2 网站显示目录列表而不是主目录/索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 MVC2 网站托管到 IIS.我遵循的步骤:

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

  1. 在 IIS 中创建网站(定义目录定义的物理路径和应用程序池)
  2. 将代码从 Visual Studio 发布到物理路径.

但是当我尝试浏览我的网站时,它给了我错误

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

HTTP 错误 403.14 - 禁止 Web 服务器配置为不列出这个目录的内容.

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. 为 aspnet_isapi.dll 添加通配符脚本映射
  2. 启用 HTTP 重定向以及我在与此问题相关的一些答案中找到的其他一些东西,但对我没有任何帮助.

我的路由配置是

   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);
    }
}

推荐答案

以下是您可能会检查的内容:

Here are the things you might check:

  1. 如果您的应用程序使用的是 ASP.NET 4,请确保它已在 IIS 中注册.以下命令应使用 aspnet_regiis.exe 工具:c:WindowsMicrosoft.NETFramework64v4.0.30319aspnet_regiis -ir(必要时使用适当版本的框架调整路径).
  2. 确保为网站配置的应用程序池使用集成管道模式.
  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.

这篇关于IIS7 上托管的 MVC2 网站显示目录列表而不是主目录/索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆