RDPSession ConnectToClient终止意外地 [英] RDPSession ConnectToClient Terminating Unexpectedly

查看:1270
本文介绍了RDPSession ConnectToClient终止意外地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地创建一个桌面共享解决方案,其中一个RDPViewer连接到RDPSession。这一切都井井有条。然而,现在我想要得到相反的工作:使用RDPViewer的StartReverseConnectListener方法,并RDPSession的ConnectToClient方法(如会话方将连接到观众身边来解决NAT /防火墙的问题)。我遵循的http://msdn.microsoft.com/en-us/library/windows/desktop/aa373359%28v=vs.85%29.aspx,主要有:

I have successfully created a desktop sharing solution where an RDPViewer connects to an RDPSession. That's all working beautifully. Now, however, I'm trying to get the opposite to work: using the RDPViewer's StartReverseConnectListener method, and RDPSession's ConnectToClient method (where the session side would connect to the viewer side to work around NAT/Firewall issues). I've followed the steps outlined at http://msdn.microsoft.com/en-us/library/windows/desktop/aa373359%28v=vs.85%29.aspx, mainly:

  1. 观众通过调用获得其连接字符串 StartReverseConnectListener方法,将空的 bstrConnectionString,bstrUserName和bstrPassword参数。

  1. The viewer obtains its connection string by calling the StartReverseConnectListener method, passing NULL for the bstrConnectionString, bstrUserName, and bstrPassword parameters.

观众通过调用启动反向连接监听器 StartReverseConnectListener方法,将空的 pbstrReverseConnectString参数和有效值, bstrConnectionString,bstrUserName和bstrPassword参数。

The viewer initiates a reverse connect listener by calling the StartReverseConnectListener method, passing NULL for the pbstrReverseConnectString parameter and valid values for the bstrConnectionString, bstrUserName, and bstrPassword parameters.

观众将步骤1中所获得的连接字符串 共享者。

The viewer sends the connection string obtained in step 1 to the sharer.

使用C#2010,我做的RDPSession方以下内容:

Using C# 2010, I've done the following on the RDPSession side:

RDPSession session = new RDPSession();
session.Open();
session.Invitations.CreateInvitation(null, "test", "12345", 1);

然后,在RDPViewer身边,我已经做了:

Then, on the RDPViewer side, I've done:

string reverseConnectString = axRDPViewer1.StartReverseConnectListener(null, null, null);

(步骤1,上图)

(step 1, above)

axRDPViewer1.StartReverseConnectListener(reverseConnectString, "test", "12345");

(步骤2,上文)

(step 2, above)

然后,重新站上RDPSession方面,我尝试使用我从观众中获得的reverseConnectString进行连接(我实际保存字符串到文件中,然后装它的RDPSession方):

Then, back on the RDPSession side, I attempt to make the connection using the reverseConnectString I obtained from the viewer (I actually saved the string to a file, and then loaded it on the RDPSession side):

session.ConnectToClient(reverseConnectString);

(第3步,同上)

(step 3, above)

一旦予执行该方法,RDPViewer侧断开与1798的错误,其中,根据 http://msdn.microsoft.com/en-us/library/aa373802%28VS.85%29.aspx ,意思是:

As soon as I execute this method, the RDPViewer side disconnects with an error of 1798, which, according to http://msdn.microsoft.com/en-us/library/aa373802%28VS.85%29.aspx, means:

ServerCertificateUnpackErr 1798

ServerCertificateUnpackErr 1798

无法解开服务器证书。

我觉得我失去了一些东西很明显,但我想不出什么。

I feel like I'm missing something obvious, but I can't figure out what.

有什么建议?

谢谢!

推荐答案

微软文档是完全错误的有关反向连接。下面是你需要做的(改编自您code以上)是什么:

The Microsoft documentation is all wrong regarding reverse connections. Here's what you need to do (adapted from your code above):

RDP会话方:

RDPSession session = new RDPSession(); 
session.Open(); 
string hostConnString = session.Invitations.CreateInvitation(null, "My Group Name", "12345", 1);

RDPViewer侧(注意 hostConnString 应该是相同的值作为检索的会话方的):

RDPViewer side (note that hostConnString should be the same value as retrieved on the session side):

string viewerConnString = axRDPViewer1.StartReverseConnectListener(hostConnString, "My Name", "12345");

现在回RDP会话方(的请注意, viewerConnString 应该是从观察者侧的检索相同的值):

Now back to the RDP session side (note that the viewerConnString should be the same value as retrieved from the viewer side):

session.ConnectToClient(viewerConnString); 

和应该这样做。几件事情要注意。在CreateInvitation指定的组名,不需要任何其他地方匹配任何内容。我认为它只是应参考你的程序需要枚举由主机启动的邀请。传递给StartReverseConnectListener的用户名也可以是任何你想要的。这可以通过查看远程名属性在 IRDPSRAPIAttendee 界面进行询问,并在主机侧使用。

And that should do it. A couple of things to note. The group name specified in CreateInvitation does not need to match anything anywhere else. I think it's just for reference should your program need to enumerate the invitations started by the host. The user name passed to StartReverseConnectListener can also be anything you want. This can be interrogated and used on the host side by looking at the RemoteName property in the IRDPSRAPIAttendee interface.

这篇关于RDPSession ConnectToClient终止意外地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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