简体   繁体   English

RPC服务器不可用。 连接到远程计算机时(来自HRESULT的异常:0x800706BA)

[英]The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) when connecting to remote computer

I try to connect remote computer by using winforms c#. 我尝试使用Winforms C#连接远程计算机。

My Code: 我的代码:

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..
}

I get below Error in line scope.Connect(); 我在line scope.Connect();下面得到了Error

Error: 错误:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Management.dll System.Management.dll中发生了类型为'System.Runtime.InteropServices.COMException'的未处理异常

Additional information: The RPC server is unavailable. 附加信息:RPC服务器不可用。 (Exception from HRESULT: 0x800706BA) (来自HRESULT的异常:0x800706BA)

Any help will be appreciated. 任何帮助将不胜感激。

I am pretty sure you did not run this application as administrator. 我很确定您没有以管理员身份运行此应用程序。

Thanks to UAC you need to run your application as administrator to get this to work. 多亏了UAC,您需要以管理员身份运行应用程序才能使其正常运行。

See How do I force my .NET application to run as administrator? 请参阅如何强制.NET应用程序以管理员身份运行? to read how to add a app.manifest to your application, forcing it to run as administrator. 了解如何将app.manifest添加到您的应用程序,以强制其以管理员身份运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WMI:RPC服务器不可用。 (尝试连接到远程计算机时抛出HRESULT异常:0x800706BA) - WMI: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) throws when try to connect to remote machine System.Runtime.InteropServices.COMException(0x800706BA):RPC服务器不可用。 (HRESULT异常:0x800706BA) - System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) WMI RPC服务器不可用。 (来自HRESULT的异常:0x800706BA) - WMI The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) RPC服务器不可用。 (来自HRESULT的异常:0x800706BA)-Excel - The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) - Excel 如何处理 System.Runtime.InteropServices.COMException (0x800706BA):RPC 服务器不可用。 (来自 HRESULT 的异常:0x800706BA) - How to handle System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) LDAP 从域外重置密码。网络 C# 错误:RPC 服务器不可用。 (hresult 的异常:0x800706ba) - LDAP reset password from outside the domain network C# Error: RPC server is unavailable. (exception from hresult: 0x800706ba) 如何修复“CCertRequest::Submit:RPC 服务器不可用。0x800706ba”错误? - How to fix "CCertRequest::Submit: The RPC server is unavailable. 0x800706ba" error? 在错误0x800706BA之前捕获RPC锁定 - Catch RPC lock before error 0x800706BA 当连接到远程计算机上的WMI时,RPC服务器不可用 - RPC server is unavailable when connecting to WMI on a remote computer 打开 xlsx 文件时出现 HRESULT 异常:0x80010105 (RPC_E_SERVERFAULT) - Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT) when opening xlsx file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM