[英]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!请帮忙!
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.