我正在尝试使用以下代码连接到另一台计算机:
String FullComputerPathName = @"\\mycomputer\";
ConnectionOptions options = new ConnectionOptions();
options.Password = "some_password";
options.Username = "some_user";
ManagementScope scope = new ManagementScope(FullComputerPathName, options);
scope.Connect();
并得到了例外:
“System.Management.WmiNetUtilsHelper”的类型初始化程序引发了异常。内部异常:ArgumentNullException:值不能为空。
日志跟踪:
“在 System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(IntPtr ptr,类型 t)
在 System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer[TDelegate] (IntPtr ptr)
在 System.Management.WmiNetUtilsHelper.LoadDelegate[TDelegate](TDelegate&delegate_f, IntPtr hModule,String procName)
在 System.Management.WmiNetUtilsHelper...cctor()"
我不明白出了什么问题。
谢谢