asp.net-mvc Server 2012 IIS 8 MVC 应用程序显示默认 IIS 主页或 403 / 404 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12134713/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 02:12:58  来源:igfitidea点击:

Server 2012 IIS 8 MVC app shows default IIS home page or 403 / 404 errors

asp.net-mvciis-8

提问by Hillbilly Coder

Running Microsoft Server 2012 RC using Oracle's free VirtualBox Application. Used a Bridged Network adapter type in the VirtualBox settings. Installed AD and DNS, IIS. Under the IIS options, Management Tools, clicked the box for Management Services. This allowed me to use the "Web Deploy" feature in Visual Studio 2012 RC. On the guest OS, I run Windows 7 Ultimate.

使用 Oracle 的免费 VirtualBox 应用程序运行 Microsoft Server 2012 RC。在 VirtualBox 设置中使用了桥接网络适配器类型。安装AD和DNS,IIS。在 IIS 选项管理工具下,单击管理服务框。这使我可以使用 Visual Studio 2012 RC 中的“Web 部署”功能。在来宾操作系统上,我运行 Windows 7 Ultimate。

I was able to successfully deploy the MVC 4 Application to IIS Default Web Site, but it wasn't displaying. Instead, the default IIS home page was. I disabled the default home page and refreshing the page displayed a 403 page. I tried typing in one of the Views and a 404 page displayed.

我能够成功地将 MVC 4 应用程序部署到 IIS 默认网站,但它没有显示。相反,默认的 IIS 主页是。我禁用了默认主页并刷新页面显示 403 页面。我尝试输入其中一个视图并显示 404 页面。

回答by Hillbilly Coder

I spent 2 days trying to find a solution to this, and finally did. Wanted to share with the community in case it helps anyone else.

我花了2天的时间试图找到解决方案,终于做到了。希望与社区分享,以防它对其他人有所帮助。

All the articles and forum messages I ran across on the Internet started to mirror each other in one form or another.

我在互联网上看到的所有文章和论坛消息都开始以一种或另一种形式相互反映。

One solution talked about making sure you have the right Application Pool configuration, using 4.0 framework and integrated. [x] Confirmed already set correctly.

一个解决方案谈到确保您拥有正确的应用程序池配置,使用 4.0 框架和集成。[x] 确认已正确设置。

Another solution extended direction to use "aspnet_regiis -i" or "aspnet_regiis -ir" which doesn't work on Microsoft Server 2012.

另一个解决方案扩展了使用“aspnet_regiis -i”或“aspnet_regiis -ir”的方向,这在 Microsoft Server 2012 上不起作用。

Another solution talked about adding the following to the web.config:

另一个解决方案谈到将以下内容添加到 web.config:

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>

However, IIS 8 serves up a response to this saying something to the effect those settings are locked from a higher configuration level and can't be used at the Application level. Meh, ok.

但是,IIS 8 对此做出了回应,表示这些设置已从更高的配置级别锁定,无法在应用程序级别使用。嗯,好的。

I ultimately tracked down an article that lead me to the following page: http://learn.iis.net/page.aspx/1097/iis-80-using-aspnet-35-and-aspnet-45

我最终找到了一篇文章,将我带到了以下页面:http: //learn.iis.net/page.aspx/1097/iis-80-using-aspnet-35-and-aspnet-45

The solution was to go back to the Microsoft Server 2012 Dashboard and select the "Add Roles" feature. Scroll down to the root "Web Server (IIS)", expand "Web Server", expand "Application Development" and select "ASP.NET 3.5" and "ASP.NET 4.5" and "Install".

解决方案是返回 Microsoft Server 2012 仪表板并选择“添加角色”功能。向下滚动到根“Web 服务器 (IIS)”,展开“Web 服务器”,展开“应用程序开发”并选择“ASP.NET 3.5”和“ASP.NET 4.5”和“安装”。

What confused me originally was I hadn't expanded "Application Development", but selected IIS and continued. On the next step, "Features", ".NET Framework 4.5 Features" was selected by default so I selected ".NET Framework 3.5 Features" and thought all would be fine.

最初让我困惑的是我没有扩展“应用程序开发”,而是选择了IIS并继续。在下一步中,默认选择了“功能”,“.NET Framework 4.5 功能”,所以我选择了“.NET Framework 3.5 功能”,并认为一切都会好起来的。

After installing the selections under "Application Development", the MVC 4.5 Applications work just the way they were designed. I hope this helps anyone who may have become stuck, like I was.

安装“应用程序开发”下的选项后,MVC 4.5 应用程序按照设计的方式工作。我希望这可以帮助任何可能陷入困境的人,就像我一样。

回答by Clevelus

I selected ".NET Framework 3.5 Features" and thought all would be fine !!! No other actions have not helped. When this problem appeared "suddenly". For a while everything worked. But after the next publishing the app worked for a few minutes, then went into error 403.14

我选择了“.NET Framework 3.5 功能”并认为一切都会好起来的!!!没有其他行动没有帮助。当这个问题“突然”出现时。有一段时间,一切都奏效了。但是在下一次发布后,该应用程序运行了几分钟,然后进入错误 403.14

回答by Abdul Basit

All you need is just to change compilation debug mode to true in web config and keep other property same. Open your Publish Folder and open Web Config file.

您只需要在 Web 配置中将编译调试模式更改为 true 并保持其他属性不变。打开您的发布文件夹并打开 Web 配置文件。

<configuration> <compilation debug="true"> </compilation> </configuration>

<configuration> <compilation debug="true"> </compilation> </configuration>