简体   繁体   English

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

[英]ASP.NET MVC 3 Deployment 403 Error on Windows Server 2008 R2

I'm deploying an MVC3 application to a new server.我正在将 MVC3 应用程序部署到新服务器。 The application runs fine on the development server (Visual Studio) and also under IIS7 on my development machine, but on the server I get a 403 error:该应用程序在开发服务器(Visual Studio)和我的开发机器上的 IIS7 下运行良好,但在服务器上出现 403 错误:

在此处输入图像描述

I have completed the following steps, but am now out of ideas.我已经完成了以下步骤,但现在没有想法。 Please help!请帮忙!

  • Using the same xcopy deployment technique that I used on my development machine, I have deployed files to the to the server and added the following permissions to the folder:使用我在开发机器上使用的相同 xcopy 部署技术,我已将文件部署到服务器,并将以下权限添加到文件夹:

IUSR - Read & execute, List folder contents, Read IIS_IUSRS - Read & execute, List folder contents, Read IUSR - 读取并执行,列出文件夹内容,读取 IIS_IUSRS - 读取并执行,列出文件夹内容,读取

  • I have also installed ASP.NET MVC3 on server so additional required.dlls are in GAC我还在服务器上安装了 ASP.NET MVC3,所以额外的 required.dll 在 GAC 中

  • IIS is set up and I can access basic html files (such as test.html that I have dropped in at the site route). IIS 已设置,我可以访问基本的 html 文件(例如我在站点路径中放入的 test.html)。

  • I have checked in Server Manager that all Role Services are installed我已经在服务器管理器中检查了所有角色服务都已安装

  • Have attempted to bin deploy by copying files from MVC install location and putting in the bin directory试图通过从 MVC 安装位置复制文件并放入 bin 目录来进行 bin 部署

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies 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 C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies

Ok, found the problem.好的,找到问题了。 Here it is incase anyone else has the same issue:这是以防其他人有同样的问题:

The Server I'm using must have had .NET 4 installed before IIS.我使用的服务器必须在 IIS 之前安装了 .NET 4。 This meant that .NET 4 hadn't been registered with IIS.这意味着 .NET 4 尚未向 IIS 注册。

I noticed the issue when checking IIS config.我在检查 IIS 配置时注意到了这个问题。 Clicking the .NET compilation icon for the website threw an exception, presumably because the application could not be compiled.点击网站的.NET编译图标抛出异常,大概是因为无法编译应用。

This led me to a stack overflow post that directed me to hanselman.com这导致我看到一个堆栈溢出帖子,将我引导到 hanselman.com

In short, I had to install VS2010 on the server so I had the Visual Studio command prompt available, and then register .NET 4 with IIS on the command line.简而言之,我必须在服务器上安装 VS2010,所以我可以使用 Visual Studio 命令提示符,然后在命令行上使用 IIS 注册 .NET 4。

IIS Manager can't configure .NET Compilation on .NET 4 Applications IIS Manager 无法配置 .NET 在 .NET 上编译 4 个应用程序

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

Key section:关键部分:

"I installed ASP.NET 4 and then installed IIS." “我安装了 ASP.NET 4,然后安装了 IIS。”

If you install VS2010 and/or .NET 4 first, then later install IIS, you need make sure IIS is configured to know about ASP.NET 4 otherwise IIS will have no idea how to run ASP.NET 4 applications. If you install VS2010 and/or .NET 4 first, then later install IIS, you need make sure IIS is configured to know about ASP.NET 4 otherwise IIS will have no idea how to run ASP.NET 4 applications.

There's a simple workaround有一个简单的解决方法

If you are already in this state, drop to the command line and navigate to the FX install directory.如果您已经在此 state 中,请转到命令行并导航到 FX 安装目录。 Then run "aspnet_regiis –iru".然后运行“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.请注意,如果您在 64 位计算机上,请从 64 位 FX 安装目录运行此命令,而不是 32 位安装目录。

or for future reference, try to enable IIS and the ASP.NET extensibility option first when your are building machines or VMs.或者为了将来参考,在您构建机器或虚拟机时,首先尝试启用 IIS 和 ASP.NET 可扩展性选项。 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.这样,当随后安装 VS 2010 或 .NET 时,安装程序将自动检测 IIS 的存在并自动注册。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将ASP.NET MVC 2应用程序部署到Windows 2008 R2 - Deploy ASP.NET MVC 2 applicatiopn to Windows 2008 R2 如何在Windows Server 2008 R2上安装ASP.net MVC 2? - How to install ASP.net MVC 2 on Windows Server 2008 R2? Windows Server 2008 R2上IIS 7.5上的ASP.NET MVC 4无法呈现CSS,JS - ASP.NET MVC 4 on IIS 7.5 on Windows server 2008 r2 does not render css, js 将 ASP.NET MVC 5 应用程序部署到 Windows Server 2008 R2 上的 IIS 7.5 - Deploying ASP.NET MVC 5 Application to IIS 7.5 on Windows Server 2008 R2 如何将ASP.Net 4.5 / MVC 4 / SQL Express 2008 R2部署到Windows Azure免费网站 - How to go about deployment of ASP.Net 4.5 / MVC 4 /SQL Express 2008 R2 to a Windows Azure Free Website ASP.NET MVC3,旨在从SQL Server CE迁移到Server 2008 R2 - ASP.NET MVC3, tyring to migrate from SQL Server CE to Server 2008 R2 使用SQL SERVER 2008 R2的ELMAH for ASP.NET MVC 4 - ELMAH for ASP.NET MVC 4 using SQL SERVER 2008 R2 尝试使用可能的错误连接字符串将ASP.NET MVC连接到SQL Server 2008 R2 - Trying to connect ASP.NET MVC to SQL Server 2008 R2 with possible wrong connection string ASP.NET MVC IIS7.5:将网站从W7移动到Windows 2008 R2后,错误处理已停止正常工作 - ASP.NET MVC IIS7.5: Error handling stopped working properly after moving website from W7 to Windows 2008 R2 将ASP.NET MVC应用程序的IIS 7.5应用程序池标识配置为SQL Server 2008 R2上的登录 - Configuring ASP.NET MVC app's IIS 7.5 Application Pool identity as login on SQL Server 2008 R2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM