asp.net-mvc - Windows Server 2008 R2 上的 ASP.NET MVC 3 部署 403 错误

标签 asp.net-mvc asp.net-mvc-3

我正在将 MVC3 应用程序部署到新服务器。该应用程序在开发服务器(Visual Studio)以及我的开发计算机上的 IIS7 下运行良好,但在服务器上我收到 403 错误:

enter image description here

我已经完成了以下步骤,但现在没有主意了。请帮忙!

  • 使用我在开发计算机上使用的相同 xcopy 部署技术,我已将文件部署到服务器并向该文件夹添加以下权限:

IUSR - 读取和执行、列出文件夹内容、读取 IIS_IUSRS - 读取和执行、列出文件夹内容、读取

  • 我还在服务器上安装了 ASP.NET MVC3,因此其他所需的 .dll 位于 GAC 中

  • IIS 已设置,我可以访问基本的 html 文件(例如我在站点路由中放入的 test.html)。

  • 我已在服务器管理器中检查所有角色服务均已安装

  • 尝试通过从 MVC 安装位置复制文件并将文件放入 bin 目录来进行 bin 部署

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies

最佳答案

好的,找到问题了。这是以防其他人遇到同样的问题:

我使用的服务器必须在 IIS 之前安装 .NET 4。这意味着 .NET 4 尚未向 IIS 注册。

我在检查 IIS 配置时注意到了这个问题。单击网站的 .NET 编译图标引发异常,可能是因为无法编译应用程序。

这让我看到了一个堆栈溢出帖子,引导我访问 hanselman.com

简而言之,我必须在服务器上安装 VS2010,以便可以使用 Visual Studio 命令提示符,然后在命令行上向 IIS 注册 .NET 4。

IIS Manager can't configure .NET Compilation on .NET 4 Applications

http://www.hanselman.com/blog/ASPNET4BreakingChangesAndStuffToBeAwareOf.aspx

关键部分:

“我安装了 ASP.NET 4,然后 安装了 IIS。”

如果您安装 VS2010 和/或 .NET 4 首先,然后安装IIS,你 需要确保 IIS 配置为 了解 ASP.NET 4,否则 IIS 不知道如何运行 ASP.NET 4 应用程序。

There's a simple workaround

If you are already in this state, drop to the command line and navigate to the FX install directory. Then run "aspnet_regiis –iru".

Note if you are on a 64-bit machine, run this command from the 64-bit FX install directory – not the 32-bit installation directory.

or for future reference, try to enable IIS and the ASP.NET extensibility option first when your are building machines or VMs. That way when VS 2010 or .NET are subsequently installed, the installation will automatically detect the presence of IIS and will auto-register with it.

关于asp.net-mvc - Windows Server 2008 R2 上的 ASP.NET MVC 3 部署 403 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6562361/

相关文章:

html - 如何让 div 溢出底部的其他内容?

jquery - 如何禁用单个 View 的客户端验证?

asp.net-mvc-3 - 如何在 MVC 3 中映射类似 (site.com/username) 的路由

c# - MVC 提交按钮未触发

asp.net - mvc5 身份 2.0.0 电子邮件确认

c# - ef6 include() 用于具有必需属性的可空属性

asp.net-mvc-3 - 将HTML代码附加到现有的Razor部分

asp.net-mvc - 将 Orchard CMS 部署到共享主机的正确方法是什么?

Jquery DataTable 删除仅适用于第一行

javascript - OnChange 事件在下拉/选择输入中触发得太快?