HTTP错误403.14 - 禁止 - MVC 4 IIS防爆preSS [英] HTTP Error 403.14 - Forbidden - MVC 4 with IIS Express

查看:100
本文介绍了HTTP错误403.14 - 禁止 - MVC 4 IIS防爆preSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是一个已经问了一个问题/回答很多次了。它不是。

This seems like a question that has already been asked/answered many times. Its not.

开发环境:
VS 2012和MVC 4,我使用的是内置的IIS防爆preSS运行应用程序。

Development Environment: VS 2012 and MVC 4. I am using the built in IIS Express to run the app.

这是错误没有发生,直到昨天。它突然开始发生,我坚持。其奇怪的是,这仅发生在一个场景。

This error was not occurring until yesterday. It suddenly began to occur and I am stuck. Its strange that It occurs only in ONE scenario.

当我尝试访问的http://本地主机:49962 / managescholars / ,它显示了我的错误

When I try to access http://localhost:49962/managescholars/, it shows me the error

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

但是,使用的http://本地主机:49962 / managescholars /指数工作正常。同一控制器的其它action方法也工作得很好。如的http://本地主机:49962 / managescholars /创建。所有其他控制器正常工作为好。

But using http://localhost:49962/managescholars/Index works fine. Other action methods of same controller also work fine. such as http://localhost:49962/managescholars/create. All other controllers work fine as well.

我曾尝试加入以下到web.config中。

I have tried adding the following to web.config.

<system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <modules runAllManagedModulesForAllRequests="true" />
  <handlers/>
</system.webServer>

我也试过运行以下命令以管理员身份

I also have tried running the following command as administrator

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

但没有一次成功。

But none of them worked.

编辑:

我已经修改我的路线。他们看起来如下:

I have modified my routes. They look as follows.

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "ManageScholarLectures",
            url: "Manage/Lectures/{userFriendlyName}",
            defaults: new { controller = MVC.ManageLectures.Name , 
                            action = MVC.ManageLectures.ActionNames.Index, 
                            userFriendlyName = UrlParameter.Optional }
        );

        routes.MapRoute(
            name: "ManageScholarEdit",
            url: "Manage/Scholars/{userFriendlyName}",
            defaults: new { controller = MVC.ManageScholars.Name, 
                            action = MVC.ManageScholars.ActionNames.Edit }
        );

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = MVC.Home.Name, 
                            action = MVC.Home.ActionNames.Index, 
                            id = UrlParameter.Optional }
        );
    }

我使用 T4MVC 模板。

它仍然不能使用,即使我离开的默认路由底部工作,并删除第一个两条路线。我做了什么错?

It still does not work even if I leave the default route at the bottom and remove the first two routes. What have I done wrong?

非常感谢提前对你的帮助。

Thanks a lot in advance for your help.

推荐答案

您的路线似乎罚款。这应该不会造成任何问题。该错误是在 HTTP只有存在的://本地主机:49962 / managescholars / 这意味着有可能是具有相同名称的其他一些资源。
你能确保你的code不误造成执行过程中的一个文件夹的 managescholars

Your routes seems fine. This should not cause any problem. The error is occuring only on http://localhost:49962/managescholars/ which means that there might be some other resource with same name. Can you make sure your code does not mistakenly creates a folder managescholars during execution?"

这篇关于HTTP错误403.14 - 禁止 - MVC 4 IIS防爆preSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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