RPC 服务器不可用.(来自 HRESULT 的异常:0x800706BA)连接到远程计算机时 [英] The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) when connecting to remote computer

查看:63
本文介绍了RPC 服务器不可用.(来自 HRESULT 的异常:0x800706BA)连接到远程计算机时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 winforms c# 连接远程计算机.

I try to connect remote computer by using winforms c#.

我的代码:

private void Form1_Load(object sender, EventArgs e)
{
    var connection = new ConnectionOptions();
    connection.Username = "xx";
    connection.Password = "xx";

    var scope = new ManagementScope("\\\\111.111.111.22:6000\\root\\CIMV2", connection);
    scope.Connect();   // Exception occurs here..
}

我得到以下错误 scope.Connect();

错误:

未处理的异常类型'System.Runtime.InteropServices.COMException' 发生在System.Management.dll

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Management.dll

附加信息:RPC 服务器不可用.(来自 HRESULT 的异常:0x800706BA)

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

任何帮助将不胜感激.

推荐答案

我很确定您没有以管理员身份运行此应用程序.

I am pretty sure you did not run this application as administrator.

感谢 UAC,您需要以管理员身份运行您的应用程序才能使其正常工作.

Thanks to UAC you need to run your application as administrator to get this to work.

参见如何做我强制我的 .NET 应用程序以管理员身份运行?阅读如何将 app.manifest 添加到您的应用程序,强制它以管理员身份运行.

See How do I force my .NET application to run as administrator? to read how to add a app.manifest to your application, forcing it to run as administrator.

这篇关于RPC 服务器不可用.(来自 HRESULT 的异常:0x800706BA)连接到远程计算机时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆