简体   繁体   English

远程桌面Active X控件无法连接

[英]Remote Desktop Active X Control doesnt connect

I'm trying to write ac# winform that uses the Remote Desktop Active X Control . 我正在尝试编写使用远程桌面Active X控件的 ac#winform。 But I'm failing to connect to my Testserver. 但是我无法连接到我的Testserver。 (To which I can connect via mstsc and the same username/password) (我可以通过mstsc和相同的用户名/密码连接到该地址)

It seams that the Control is stuck in the Connecting state as this is the only event that fires and the Control remains white. 它表明控件卡在了“连接”状态,因为这是唯一触发的事件,并且控件保持白色。

I've added this control vom the COM Components: Component Selection 我已经在COM组件中添加了此控件: 组件选择

My code is: 我的代码是:

private void Connect()
    {
        rdpClient.Server = "10.0.0.13";
        rdpClient.UserName = "test";
        rdpClient.AdvancedSettings2.ClearTextPassword = "test";

        rdpClient.OnConnecting += RdpClientOnOnConnecting;
        rdpClient.OnConnected += RdpClientOnOnConnected;
        rdpClient.OnWarning += RdpClientOnOnWarning;
        rdpClient.OnFatalError += RdpClientOnOnFatalError;

        rdpClient.Connect();
    }

Can anyone tell me what I'm doing wrong? 谁能告诉我我在做什么错?

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

PS. PS。 I'm using a Windows 10 PC for development if that changes anything 我正在使用Windows 10 PC进行开发,如果有任何更改

You should also set the property of Credential support . 您还应该设置凭据支持的属性。 Add this line after setting the clear passowrd 设置清除密码后添加此行

 rdpClient.AdvancedSettings8.EnableCredSspSupport = true;

So your full code should look like this 因此,您的完整代码应如下所示

private void Connect()
{
    rdpClient.Server = "10.0.0.13";
    rdpClient.UserName = "test";
    rdpClient.AdvancedSettings2.ClearTextPassword = "test";
    rdpClient.AdvancedSettings8.EnableCredSspSupport = true;

    rdpClient.OnConnecting += RdpClientOnOnConnecting;
    rdpClient.OnConnected += RdpClientOnOnConnected;
    rdpClient.OnWarning += RdpClientOnOnWarning;
    rdpClient.OnFatalError += RdpClientOnOnFatalError;

    rdpClient.Connect();
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM