HTTP错误403.14 - 禁止 - 发布MVC 4项目时

时间:2015-07-23 08:15:37

标签: c# asp.net-mvc asp.net-mvc-4 web-hosting

这似乎是一个已被多次询问/回答的问题。不是。

开发环境:VS 2013和MVC 4,Visual C#。我使用内置的IIS Express来运行应用程序。

使用Ftp详细信息发布网站时,它显示成功发布,并且所有文件都存储在wwwroot文件夹中(使用FileZilla检查)

但是当我打开网站时,显示以下错误

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

A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

Things you can try:

If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing using IIS Manager.
    Open IIS Manager.
    In the Features view, double-click Directory Browsing.
    On the Directory Browsing page, in the Actions pane, click Enable.
Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.

Detailed Error Information:
Module     DirectoryListingModule
Notification       ExecuteRequestHandler
Handler    StaticFile
Error Code     0x00000000
Requested URL      http://www.infokairali.com:80/
Physical Path      E:\HostingSpaces\infokairali\infokairali.com\wwwroot
Logon Method       Anonymous
Logon User     Anonymous

我已经完成了IIS中的所有操作,如上所述。 并更改web.config文件,如

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers></system.webServer>
</configuration>

但仍然存在同样的错误。请帮帮我

1 个答案:

答案 0 :(得分:0)

我怀疑这是一个路由问题。默认情况下,路由中有默认控制器和操作,例如:

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

我试过评论&#34;默认&#34;上面的参数并开始得到HTTP 403.14错误。请确保将默认值设置为有效的控制器和操作。