在Windows 8上,aspnet_regiis.exe -ir无法工作。

47

我正在尝试将一个ASP.NET MVC3应用部署到我的Windows 8桌面上,使用的是IIS8。当我尝试路由到该网站时,我会得到以下错误:

HTTP Error 403.14 - Forbidden

几乎所有我能找到的关于此问题的内容都建议运行:

aspnet_regiis.exe -ir

当我在我的Windows 8电脑上运行这个程序时,我收到了以下消息:

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Justin>C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe
-ir
Microsoft (R) ASP.NET RegIIS version 4.0.30319.17929
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation.  All rights reserved.
Start installing ASP.NET (4.0.30319.17929) without changing existing web 
applications to use this version of ASP.Net.  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.
Finished installing ASP.NET (4.0.30319.17929) without changing existing web 
applications to use this version of ASP.Net.

我的系统已经安装了ASP.NET 4.5。

Windows Features

我的应用程序在Visual Studio中可以正常运行,但我无法成功部署它。我对接下来该怎么做完全一头雾水。我已经尝试了这个站点的集成和经典管道模式,但都没有成功。

3个回答

41
运行以下命令,将在 IIS 中安装并注册 ASP.NET 4.5:
dism /online /enable-feature /featurename:IIS-ASPNET45 /all

我在VS命令提示符(以管理员模式)下运行了这个命令,问题得到了解决 :) 谢谢。 - Biki
部署映像服务和管理工具 版本:6.3.9600.17031映像版本:6.3.9600.17031启用功能 [==========================100.0%==========================] 操作成功完成。 - Biki
我在管理员模式下的命令提示符上运行了这个命令,并且它在我的Windows 8.1操作系统中的IIS 8.5上工作正常。 - Sheikh M. Haris
好的,谢谢。为什么微软不把这个放到aspnet_regiis的输出消息中,而是放一些链接到一些支持文章,这些文章很快就会过时呢? - cdonner
这个命令解决了我的问题。 - Firas Nizam
显示剩余2条评论

22
我遇到了同样的问题。到目前为止,我只找到了这个论坛帖子,其中一个答案指出通过Web平台安装程序安装可以解决这个问题,但对我无效。IIS ASP.NET 4.5功能已禁用,因为它已经安装。

更新: 最终我解决了这个问题。

按照这个SO问题的说明,在IIS中启用wcf服务: WCF on IIS8; *.svc handler mapping doesn't work

这里还有一些关于如何安装处理程序映射的信息。


2
我成功的方法如下: - 在“添加/删除Windows功能”中取消勾选4.5和3.5 - 重新启动电脑 - 在“添加/删除Windows功能”中勾选4.5和3.5
从此以后,一切都恢复正常了。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接