gpt4 book ai didi

c# - WMI RPC 服务器不可用。 (来自 HRESULT : 0x800706BA) 的异常

转载 作者:可可西里 更新时间:2023-11-01 13:28:08 29 4
gpt4 key购买 nike

我的申请要求如下。应用程序将在域管理系统上运行,该系统将 ping 该域下的所有机器,它将从所有域系统获取磁盘驱动器、CPU 和 RAM 详细信息。

每当我尝试 ping 机器时,我都会收到错误

"The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)"

我用来连接远程机器的代码是

ConnectionOptions options = new ConnectionOptions();
options.EnablePrivileges = true;
options.Impersonation = ImpersonationLevel.Impersonate;
options.Username = System.Configuration.ConfigurationSettings.AppSettings["AccessUserName"].ToString();
options.Password = System.Configuration.ConfigurationSettings.AppSettings["AccessPassword"].ToString();
options.Authority = "ntlmdomain:" + System.Configuration.ConfigurationSettings.AppSettings["DomainName"].ToString();
options.Authentication = AuthenticationLevel.Packet;
ManagementScope scope = new ManagementScope("\\\\" + sMachineIP + "\\root\\cimv2", options);
scope.Connect();

最佳答案

我找到了解决方案。我通过在 Windows 防火墙中启用 Windows Management Instrumentation (WMI) 规则来做到这一点。

  1. Open Windows Firewall.
  2. Allow app or feature through Windows Firewall.
  3. Enable Domain Privilege for Windows Management Instrumentation(WMI).

您还可以检查其他一些内容。

  1. 远程计算机被防火墙阻止。
    解决方案:打开组策略对象编辑器管理单元 (gpedit.msc) 以编辑用于管理 Windows 防火墙设置的组策略对象 (GPO)在您的组织中。打开计算机配置,打开管理模板,打开网络,打开网络连接,打开 Windows 防火墙,然后打开域配置文件或标准配置文件,具体取决于您要配置的配置文件。启用以下异常(exception):Allow Remote Administration ExceptionAllow File and Printer Sharing Exception
  2. 主机名或IP地址错误或远程计算机关机。
    解决方案:验证主机名或 IP 地址是否正确。
  3. “TCP/IP NetBIOS Helper”服务未运行。
    解决方案:确认“TCP/IP NetBIOS Helper”正在运行并设置为重启后自动启动。
  4. “远程过程调用 (RPC)”服务未在远程计算机上运行。
    解决方案:使用 Windows 运行打开 services.msc。在 Windows 服务中,确认远程过程调用 (RPC) 正在运行并设置为重启后自动启动。
  5. “Windows Management Instrumentation”服务未在远程计算机上运行。
    解决方案:使用 Windows 运行打开 services.msc。确认 Windows Management Instrumentation 服务正在运行并设置为重启后自动启动。

关于c# - WMI RPC 服务器不可用。 (来自 HRESULT : 0x800706BA) 的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25499050/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com