【发布时间】:2018-01-18 11:57:27
【问题描述】:
我有 Mac,可以通过路由器上的 NATed 端口 6535 从外部网络访问;路由器本身也暴露了 22 端口。我希望通过 Xamarin Mac 代理从外部网络连接到我的 Mac。
我可以通过 SSH(腻子)连接到路由器和 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 只是忽略了端口指令。
我在提升的开发人员命令提示符下使用以下 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]
【问题讨论】:
-
您可以随时在路由器上设置端口转发,将路由器上的外部端口 22 转发到 Mac 上的内部端口 6535 或 22。
-
不,路由器上的 22 端口已被占用,我无法交换此分配 :(
-
为什么不呢?它是否已经路由到另一台计算机?还是路由器根本不允许您更改此设置?你有什么路由器?
-
路由器已经将端口 22 路由到其他计算机,并且这些服务在全球范围内使用,因此我无法为 Mac NATting 暴露端口 22。我暴露了端口 6535 并将其 NAT 到 Mac 上的端口 22 - 并且可以与 ssh (Putty) 完美连接。
标签: xamarin xamarin.ios msbuild visual-studio-2017