使用连接参数连接到 Azure VM 时,远程桌面 ActiveX 不会对连接命令做出反应。ActiveX 窗口保持白色,而不是显示远程桌面会话初始化。如何正确使用远程桌面客户端 ActiveX 连接 Azure?
.RDP 文件示例
full address:s:<cloudservice>.cloudapp.net
username:s:<username>
LoadBalanceInfo:s:Cookie: mstshash=<role>#<roleinstance>
我使用嵌入在 WPF WindowsFormsHost 中的 ActiveX。(我已经用另一台 LAN 电脑进行了测试,远程会话建立成功。(提供服务器、用户名和密码)。
<WindowsFormsHostEx x:Name="m_host" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
FlowDirection="LeftToRight">
<axMstscLib:AxMsTscAxNotSafeForScripting x:Name="m_remoteDesktop"/>
</WindowsFormsHostEx>
当试图将这些信息嵌入到 ActiveX 中时。命令没有反应。连接值保持为“2”...并且没有发生 OnConnected、OnDisconnected、OnFatalError、OnLogonError。
m_remoteDesktop.Server = "<cloudservice>.cloudapp.net";
m_remoteDesktop.UserName = "<username>";
IMsRdpClientAdvancedSettings settings = m_remoteDesktop.AdvancedSettings as IMsRdpClientAdvancedSettings;
if (settings != null)
{
settings.LoadBalanceInfo = "Cookie: mstshash=<Role>#<RoleInstance>";
settings.ClearTextPassword = "<rdp pass>";
}
m_remoteDesktop.Connect();
short connected = m_remoteDesktop.Connected;