开发者

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

I need to detect if WCF H开发者_StackOverflow中文版ttp/Non-Http Activation Components is installed during the installation of my product. How can I do so?

Thanks.


For IIS7, check the following Registry Key:

HKEY_LOCAL_MACHINE\Software\Microsoft\InetStp\Components\

For the following components:

  • Process Model - ProcessModel
  • .NET Environment - NetFxEnvironment
  • Configuration APIs - WASConfigurationAPI

From this page: 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

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:

pkgmgr /iu: WCF-NonHTTP-Activation

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


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

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

zero means not installed, and 1 means installed.


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

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


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:

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


The registry key for HTTP activation is:

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

, and for non-HTTP activation is checking whether the service NetTcpActivation or NetPipeActivator exist on the machine and are running.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜