System.InvalidProgramException 创建 CIMSession 时出现 C# 错误
System.InvalidProgramException Error C# when creating CIMSession
尝试远程连接到另一台 PC 的 WMI,但在创建 CimSession 时出现以下错误
System.InvalidProgramException:'Common Launguage Runtime detexted an invalid program'
我是运行的代码如下
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
尝试远程连接到另一台 PC 的 WMI,但在创建 CimSession 时出现以下错误
System.InvalidProgramException:'Common Launguage Runtime detexted an invalid program'
我是运行的代码如下
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