创建CIMSession时System.InvalidProgrameException错误C#
试图远程连接到另一台电脑的WMI,但在创建CimSession时,我遇到以下错误 System.InvalidProgrammeException:'Common Launguage运行时删除了无效程序' 我正在运行的代码如下创建CIMSession时System.InvalidProgrameException错误C#,c#,wmi,C#,Wmi,试图远程连接到另一台电脑的WMI,但在创建CimSession时,我遇到以下错误 System.InvalidProgrammeException:'Common Launguage运行时删除了无效程序' 我正在运行的代码如下 using System; using System.Text; using System.Threading; using Microsoft.Management.Infrastructure; using Microsoft.Management.Infrastru
using System;
using System.Text;
using System.Threading;
using Microsoft.Management.Infrastructure;
using Microsoft.Management.Infrastructure.Options;
using System.Security;
namespace SMAPIQuery
{
class Program
{
static void Main()
{
string computer = "ComputerB";
DComSessionOptions DComOptions = new DComSessionOptions();
DComOptions.Impersonation = ImpersonationType.Impersonate;
CimSession Session = CimSession.Create(computer, DComOptions);
}
}
}
不确定是什么引发了此错误或如何避免此错误问题是我使用的是.Net Core而不是.Net Framework能否在
Main()
函数上添加Try..Catch
块?异常对象中的错误应该能够为您提供更多信息。