【问题标题】:RDP client loopRDP 客户端循环
【发布时间】:2013-08-20 13:58:36
【问题描述】:
private void RDP(string pass)
{
    try
    {
        rdp.Server = TBIP.Text;
        rdp.UserName = TBUserName.Text;
        IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
        secured.ClearTextPassword = pass;
        rdp.Connect();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex);
    }
}

此标准要求运行良好:

RDP("123");

我如何制作一个循环。例如,这不起作用:

foreach (var p in pwd)
{
    RDP(p);
    Thread.Sleep(30 * 1000);
    rdp.Disconnect();
    rdp.AllowDrop = true;
}

它在“59”行引发错误。

rdp.Server = TBIP.Text;

“异常输出”

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in AxInterop.MSTSCLib.dll
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at MSTSCLib.IMsRdpClient8.set_Server(String pServer)
   at AxMSTSCLib.AxMsRdpClient8.set_Server(String value)
   at RDP.Form1.RDP() in c:\Users\x\Documents\Visual Studio 2012\Projects\RDP\RDP\Form1.cs:line 59

【问题讨论】:

  • 小心分享错误信息还是猜谜游戏? “不起作用”意味着您收到错误,什么错误

标签: c# .net winforms


【解决方案1】:

我可以重复您的错误,但我无法使用 RDP 进行广泛测试,但也许 this post 可以帮助您。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-17
    • 2017-01-26
    • 2021-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-15
    相关资源
    最近更新 更多