在 Windows 8 中的 IIS 8 上使用 .NET 4.5 的 MVC 4 网站给出 403.14 禁止错误

问题描述:

我有一个使用 MVC 4 和 .NET 框架 4.5 在 Visual Studio 2012 中构建的网站.当我尝试在运行 Windows 8 Pro 的机器上通过 IIS 8 运行它时,出现 403.14 错误.它说

I have a website that I built in Visual Studio 2012 using MVC 4 and .NET framework 4.5. When I try to run it via IIS 8 on a machine running Windows 8 Pro, I get a 403.14 Error. It says

"禁止Web 服务器配置为不列出此目录的内容.

"Forbidden The Web server is configured to not list the contents of this directory.

最可能的原因:未为请求的 URL 配置默认文档,且服务器上未启用目录浏览."

Most likely causes: A default document is not configured for the requested URL, and directory browsing is not enabled on the server."

以下是我尝试过的一些无效的方法:

Here are some things I have tried that did not work:

  • 运行 %windir%Microsoft.NETFrameworkv4.0.30319aspnet_regiis.exe -i 和%windir%Microsoft.NETFrameworkv4.0.30319aspnet_regiis.exe -ir 在此目录和 Framework64 目录中.这会产生以下错误:此版本的操作系统不支持此选项.管理员应改为使用打开/关闭 Windows 功能"对话框、服务器管理器管理工具或使用 IIS8 安装/卸载 ASP.NET 4.5dism.exe 命令行工具.有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=216771."该链接转到有关 Windows Server 2012 的页面,但没有帮助.我在 iis 8 的打开或关闭 Windows 功能"对话框中找不到特定设置.与 .net 4.5 相关的所有内容都已打开.
  • 在 Web.config 中添加.这会产生错误:此配置部分不能在此路径上使用.当该部分在父级别锁定时会发生这种情况.锁定是默认情况下(overrideModeDefault="Deny"),或者由具有 overrideMode 的位置标记显式设置="拒绝" 或旧的 allowOverride="false"."
  • Run %windir%Microsoft.NETFrameworkv4.0.30319aspnet_regiis.exe -i and %windir%Microsoft.NETFrameworkv4.0.30319aspnet_regiis.exe -ir in both this and the Framework64 directory. This gives this error: "This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771." The link goes to a page about Windows Server 2012 which does not help. I could not find a specific setting in "Turn Windows Features on or off" dialog for iis 8. Everything relating to .net 4.5 is turned on.
  • Add to in Web.config. This gives the error: "This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false"."

我已经确定服务器上安装了 .net 4.5(安装程序说它内置于 Windows 8 中,不需要安装).应用程序池是使用 .net 4.0、集成管道的默认池,启用了 32 位应用程序.我正在发布到默认目录 (inetpubwwwroot) 并且那里的默认站点运行良好.在打开或关闭 Windows 功能"中开启 HTTP 重定向

I have made sure .net 4.5 is installed on the server (the installer said it is built into windows 8 and does not need to be installed). The application pool is the default pool using .net 4.0, integrated pipeline, with 32 bit applications enabled. I'm publishing to the default directory (inetpubwwwroot) and the default site that was there worked fine. HTTP Redirection is turned on in "Turn windows features on or off"

谁能提供更多见解?

嗯,当然,在我发布这篇文章之后,我发现了一些有用的东西.去图.

Well, of course right after I post this I found something that works. Go figure.

在打开或关闭 Windows 功能"中,在 Internet 信息服务 -> 万维网服务 -> 应用程序开发功能下,确保 .NET Extensibility 3.5、.NET Extesibility 4.5、ASP.NET 3.5、ASP.NET4.5、ISAPI 扩展和 ISAPI 过滤器被选中.

In "Turn Windows Features on or off", under Internet Information Services -> World Wide Web Services -> Application Development Features, make sure that .NET Extensibility 3.5, .NET Extesibility 4.5, ASP.NET 3.5, ASP.NET 4.5, ISAPI Extensions, and ISAPI Filters are SELECTED.

此处概述:http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45#TOC301258515 但由于它指的是 server 2012 而不是 windows 8,我找不到这些设置的正确位置.

This was outlined here: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45#TOC301258515 but since that refered to server 2012 instead of windows 8 I couldn't find the right location for these settings.

希望这可以帮助任何有类似问题的人.感谢阅读.

Hope this helps anyone with a similar problem. Thanks for reading.

在打开或关闭 Windows 功能"中,在 Internet 信息服务 -> 万维网服务 -> 应用程序开发功能下,确保 .NET Extensibility 3.5、.NET Extesibility 4.5、ASP.NET 3.5、ASP.NET 4.5、ISAPI 扩展和 ISAPI 过滤器被选中.

In "Turn Windows Features on or off", under Internet Information Services -> World Wide Web Services -> Application Development Features, make sure that .NET Extensibility 3.5, .NET Extesibility 4.5, ASP.NET 3.5, ASP.NET 4.5, ISAPI Extensions, and ISAPI Filters are SELECTED.

此处概述:http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45#TOC301258515 但由于它指的是 server 2012 而不是 windows 8,我找不到这些设置的正确位置.

This was outlined here: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45#TOC301258515 but since that refered to server 2012 instead of windows 8 I couldn't find the right location for these settings.

注意:已添加答案以清除未回答的问题