首页 文章

使用Xamarin Mac代理连接到使用自定义SSH端口在NAT后面运行的Mac

提问于
浏览
0

我有Mac,可以通过路由器上的NATed端口6535从外部网络访问;路由器本身也暴露了端口22 . 我希望通过Xamarin Mac代理连接外部网络到我的Mac .

我可以通过SSH(Putty)将它们连接到路由器和Mac,但当我尝试从Visual Studio 2017(或MsBuild命令提示符)连接到Mac时输入服务器IP,如1.1.1.1:6535(其中1.1.1.1)用我的路由器外部IP代替 - 我通过指纹看到,Studio正在使用端口22进行连接(我看到我的路由器指纹,而不是我的Mac指纹) .

是否有可能从Visual Studio和 MsBuild 中运行的Xamarin Mac代理连接到自定义端口?

Can the Xamarin Mac Agent's port be configured? (to something other than port 22) - 建议我需要先成功连接,但我不能 . 从机器导入注册表项,连接成功没有帮助,因为VS仍然试图通过指纹看到的端口22碰到远程主机(所以,我仍然无法从Visual Studio连接) . 如果我尝试直接调用MsBuild - 它也会失败,因为MsBuild只是忽略了port指令 .

我在提升的开发人员命令提示符下使用以下cmdline启动MsBuild: msbuild mySolution.sln /t:Clean;Build /p:Configuration="Release";IpaPackageDir=C:\t\;Platform=iPhone;ServerAddress=1.1.1.1;ServerPort=6535;ServerUser=user;ServerPassword=password

作为回应,我收到以下信息:

_SayHello:
  Connecting to Mac server 1.1.1.1...
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets(63,
5): warning : Ignoring server port when the build is not running inside Visual Studio. [myprojectpath\myproject.csproj]
  Starting connection to 1.1.1.1...

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets(63,
5): warning : Could not authenticate the user 'user' with the provided credentials [myprojectpath\myproject.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets(63,
5): warning VSX1000: A connection to the Mac Server couldn't be established with Address='1.1.1.1' and User='user', so only the main assembly was compiled for project 'myproject'. Connect to a Mac Server and try again to build
the full application. [myprojectpath\myproject.csproj]

1 回答

  • 0

    请看下面的帖子,相信这会对你有帮助 .

    Configure xamarin Mac agent port to something other than 22

    我已经标记了这一点,因为我认为它在大多数情况下是重复的 .

    跟进:在您的路由器配置中,您可以:

    • 暂时将端口映射22分配给您的Mac并进行测试以确保其有效,然后您可以将其重新设置 .

    • 创建一个端口映射,将"router external"(您的6 ***号码)指向"mac IP address internal port 22",如果您的路由器最像,您应该能够将此外部端口分配给端口22上的Mac IP .

    如果您遇到此问题,请提供上述路由器配置的屏幕截图,以便我们提供帮助 .

    问候

    编辑:添加额外信息

相关问题