windows 如何以编程方式检查 WCF Http/Non-Http 激活组件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4345475/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:43:47  来源:igfitidea点击:

How to programmatically check WCF Http/Non-Http Activation components?

.netwindowswcfwix

提问by Dmitrii

I need to detect if WCF Http/Non-Http Activation Components is installed during the installation of my product. How can I do so?

我需要检测在我的产品安装过程中是否安装了 WCF Http/Non-Http 激活组件。我该怎么做?

Thanks.

谢谢。

采纳答案by DarrellNorton

For IIS7, check the following Registry Key:

对于 IIS7,请检查以下注册表项:

HKEY_LOCAL_MACHINE\Software\Microsoft\InetStp\Components\

HKEY_LOCAL_MACHINE\Software\Microsoft\InetStp\Components\

For the following components:

对于以下组件:

  • Process Model - ProcessModel
  • .NET Environment - NetFxEnvironment
  • Configuration APIs - WASConfigurationAPI
  • 流程模型 - 流程模型
  • .NET 环境 - NetFxEnvironment
  • 配置 API - WASConfigurationAPI

From this page: http://learn.iis.net/page.aspx/135/discover-installed-components/

从这个页面:http: //learn.iis.net/page.aspx/135/discover-installed-components/

UPDATE:Since the above is true even when the components are not installed, try running this command from the command line:

更新:由于即使未安装组件,上述情况也是如此,请尝试从命令行运行此命令:

sc query nettcpactivator

sc 查询 nettcpactivator

If the service is stopped or does not exist, the WCF Non-HTTP Activation components are likely not installed. To install them, run this command:

如果该服务已停止或不存在,则可能未安装 WCF 非 HTTP 激活组件。要安装它们,请运行以下命令:

pkgmgr /iu: WCF-NonHTTP-Activation

pkgmgr /iu: WCF-NonHTTP-Activation

Source: http://blogs.msdn.com/b/drnick/archive/2010/05/11/debugging-a-missing-hostedtransportconfiguration-type.aspx

来源:http: //blogs.msdn.com/b/drnick/archive/2010/05/11/debugging-a-missing-hostedtransportconfiguration-type.aspx

回答by Bill Moon

For IIS8 with Windows Server 2012 (and probably Windows 8), you can check this registry key (for .NET 4.5)

对于带有 Windows Server 2012(可能还有 Windows 8)的 IIS8,您可以检查此注册表项(对于 .NET 4.5)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\ServicingStorage\ServerComponentCache\NET-WCF-HTTP-Activation45\InstallState

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\ServicingStorage\ServerComponentCache\NET-WCF-HTTP-Activation45\InstallState

zero means not installed, and 1 means installed.

零表示未安装,1 表示已安装。

回答by Luis Rocha

You also can use PowerShell to enable WCF Http/Non-Http Activation components:

您还可以使用 PowerShell 启用 WCF Http/Non-Http 激活组件:

Import-Module ServerManager
Add-WindowsFeature NET-HTTP-Activation,NET-Non-HTTP-Activ

This way you do not have to mess up with Windows Registry. For more info about adding Windows feature with PowerShell: http://technet.microsoft.com/en-us/library/cc732263.aspx#BKMK_powershell

这样您就不必弄乱 Windows 注册表。有关使用 PowerShell 添加 Windows 功能的更多信息:http: //technet.microsoft.com/en-us/library/cc732263.aspx#BKMK_powershell

回答by Developer

You should probably use the Get-WindowsFeature powershell commandlet. You can check the existence on Server 2012 of .NET Framework 4.5 WCF Services for HTTP Activation by calling:

您可能应该使用 Get-WindowsFeature powershell commandlet。您可以通过调用以下方法检查 .NET Framework 4.5 WCF Services for HTTP Activation 在 Server 2012 上是否存在:

$wcfActivationFeature = Get-WindowsFeature -name NET-WCF-HTTP-Activation45
$wcfActivationFeature.Installed

回答by Daniel B

The registry key for HTTP activation is:

HTTP 激活的注册表项是:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\Windows Communication Foundation\HTTPActivation

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\Windows Communication Foundation\HTTPActivation

, and for non-HTTPactivation is checking whether the service NetTcpActivationor NetPipeActivatorexist on the machine and are running.

以及用于non-HTTP激活被检查是否该服务NetTcpActivationNetPipeActivator存在的机器上,并且正在运行。