aspnet_regiis -c 0x80040154 Class 未注册

aspnet_regiis -c 0x80040154 Class not registered

我对 windows 8.1 和 .NET 2 有一个奇怪的问题(是的,我必须将它用于这个项目)。 运行 aspnet_regiis -c for .NET 4.5 没有错误,并说它正确复制了客户端文件。当我进入 .NET 2 文件夹时出现此错误:

C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis -c
Start copying the ASP.NET client script files for this version (2.0.50727).
An error has occurred: 0x80040154 Class not registered

The error indicates that IIS is not installed on the machine. Please install IIS
 before using this tool.

我读了一些书,关于 SO 的一个回答是:

I have found a easy workaround for this which does not include running the aspnet_regiis -c command. Under your default site in IIS, you should already have following directory structure:

aspnet_clinet --> system_web --> 2_0_50727 All you have to do is copy your themes into ...\wwwroot\aspnet_client\system_web_0_50727\Themes on your file system and then create a IIS virtual directory "Themes" in aspnet_client\system_web_0_50727 which maps to your file system Themes directory.

Link: IIS7 .NET x64 aspnet_regiis -i causes class not registered error

我不知道这是否真的是一个好的解决方案,尤其是因为这似乎是 .NET 2 和 Windows 8.1 之间的兼容性问题。还有其他解决方法吗?

免责声明

首先,让我先声明一下我真的不知道命令 aspnet_regiis -c 应该做什么。 aspnet_regiis documentation 有点含糊——它说应该安装客户端脚本,但它没有提供有关这些脚本的任何信息。

无论如何,当我在较早的 OS (Win 2003 Server) 上 运行 它时,它所做的只是创建一些空目录(实际上并没有将任何脚本复制到其中) .

此答案解决了您看到的错误并允许 Windows 8.x 执行与 Win 2003 相同的操作 - 即在您的 Web 应用程序目录下创建一些空目录。但是,我不知道这是否真的允许您的应用程序执行它需要执行的操作。

解决您的问题

.Net 2 aspnet_regiis -c 命令假定已安装 IIS 管理服务。这是 IIS 6 的遗留服务,默认情况下当然不会在 Windows 8.x.

中安装

您可以通过转至 控制面板 中的 程序和功能 并启用 IIS 6 来安装此服务管理兼容性 特性及其子项:

完成上述操作后,您应该可以运行命令:

C:\Windows\Microsoft.NET\Framework64\v2.0.50727> .\aspnet_regiis.exe -c
Start copying the ASP.NET client script files for this version (2.0.50727).
Finished copying the ASP.NET client script files for this version (2.0.50727).

正如我之前所说,所有这一切只是在您的网络应用程序下创建空文件夹,可能会或可能不会真正解决您的问题。举个例子,假设您只有默认的 IIS Web 应用程序,它将创建以下目录结构:

C:\Inetpub\wwwroot\aspnet_client\system_web_0_50727