Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Windows服务的解耦WMI提供程序_C#_Powershell_Service_Wmi - Fatal编程技术网

C# Windows服务的解耦WMI提供程序

C# Windows服务的解耦WMI提供程序,c#,powershell,service,wmi,C#,Powershell,Service,Wmi,我有一个WMI提供程序,由于设计限制,我想将其作为一个解耦的提供程序添加到Windows服务(WS)。我将遵循以下简单步骤: 在VS中的Windows服务解决方案中,我将WMI提供程序添加为一个项目 将主机模型设置为HostingModel=ManagementHostingModel.Decoupled 更改WS的安装项目,以便在安装期间将提供程序的输出dll复制到c:\Prog…\xyz文件夹 我希望解耦的提供程序像以前一样工作(所有类实例都和以前一样-没有行为改变)。provider和WS

我有一个WMI提供程序,由于设计限制,我想将其作为一个解耦的提供程序添加到Windows服务(WS)。我将遵循以下简单步骤:

  • 在VS中的Windows服务解决方案中,我将WMI提供程序添加为一个项目
  • 将主机模型设置为HostingModel=ManagementHostingModel.Decoupled
  • 更改WS的安装项目,以便在安装期间将提供程序的输出dll复制到c:\Prog…\xyz文件夹
  • 我希望解耦的提供程序像以前一样工作(所有类实例都和以前一样-没有行为改变)。provider和WS都是用C#编写的。我还没有在WS中注册提供商-我需要做什么(如果是,怎么做?)

    但是,当我尝试通过PowerShell枚举类时,会出现以下错误: FullyQualifiedErrorId:HRESULT 0x80041016,Microsoft.Management.Infrastructure.CIMCmdlet.GetCimInstanceCommand

    另外,当通过Process Explorer查看时,我可以看到提供程序dll显示在WS的流程中

    为什么我会犯这个错误