我无法从 Visual Studio 2015 使用 Xamarin Mac Agent 连接到 Mac [英] I can't connect to Mac with Xamarin Mac Agent from Visual Studio 2015

查看:17
本文介绍了我无法从 Visual Studio 2015 使用 Xamarin Mac Agent 连接到 Mac的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将继续与 Xamarin 一起冒险.

我正在开发一个带有可移植类库 (PCL) 的 Xamarin Forms 应用程序.

我已经通过 Android 编译和调试了我的应用程序,但现在我有兴趣在 iOS 中运行该应用程序以在此平台上进行测试.

我的 PC 和 Mac 之间的连接有问题.

我有一台装有 Visual Studio Community 2015 且安装了 Xamarin 工具的 PC (Windows 8.1).

在我的 Mac Mini 中,我安装了 OS X (v10.11.3)、XCode (v7.2) 和 Xamarin Studio.我已使用 Xamarin 帐户登录.

在两台机器上我有相同的 Xamarin 版本.

我已遵循

此时登录有效.

然后,在解决方案中,我将iOS项目设置为启动项目.我清理了解决方案,重新构建并开始编译/调试过程 (F5).

此时,输出检索到一条消息:

<块引用>

1>连接到 Mac 服务器 Macs-Mac-mini.local...

1>C:Program Files (x86)MSBuildXamariniOSXamarin.iOS.Windows.After.targets(54,5): 警告:无法使用现有的 ssh 密钥对用户进行身份验证

1>C:Program Files (x86)MSBuildXamariniOSXamarin.iOS.Windows.After.targets(54,5): 错误:无法连接到 Address='Macs-Mac-mini.本地'与 User='macmini

我已经使用 Putty(SSH 客户端)检查我的用户/密码是否能够连接到 Mac,并且我已经成功了.

每次使用 Xamarin Mac Agent 时,进入/Users/macmini2/.ssh/authorized_keys 文件(Mac 机),Visual Studio 都会添加一个新的密钥条目(它添加了相同的重复项).

我发现问题可能与 ssh 密钥有关.为什么我有这个问题?我做错了什么?

我测试过的一件事是使用 Xamarin Studio 在 Mac 中直接打开 Xamarin 项目,构建它并运行模拟器.它有效.

我见过其他类似的问题,但我认为它没有同样的问题.

有关我尝试编译/调试时出现的错误的更多具体信息:

无法使用现有的 ssh 密钥对用户进行身份验证Xamarin.Messaging.VisualStudio.MessagingAuthenticationException:无法使用现有的 ssh 密钥对用户进行身份验证 --->Renci.SshNet.Common.SshAuthenticationException:权限被拒绝(公钥).en Renci.SshNet.ClientAuthentication.Authenticate(IConnectionInfoInternal connectionInfo, ISession session)en Renci.SshNet.ConnectionInfo.Authenticate(ISession session)Renci.SshNet.Session.Connect()Renci.SshNet.BaseClient.Connect()Xamarin.Messaging.VisualStudio.MessagingService.d__70.MoveNext()--- Fin del seguimiento de la pila de la excepción interna ---

编辑 2:

我已经修改了排除 Xamarin 页面的故障,特别是它说无法使用 SSH 密钥进行身份验证.请先尝试使用凭据登录".

我已经跑了:

chmod og-w "$HOME";grep sshd/var/log/system.log >$HOME/Desktop/sshd.log"光盘桌面猫sshd.log

文件内容为:

Apr 18 09:23:28 Macs-Mac-mini sshd[769]:身份验证被拒绝:目录/Users/macmini2/.ssh 的所有权或模式不正确4 月 18 日 09:25:27 Macs-Mac-mini com.apple.xpc.launchd[1] (com.openssh.sshd.EE9A94ED-????-....-????-77254934B300[769]):服务退出异常代码:14 月 18 日 09:59:39 Macs-Mac-mini sshd[1036]:接受来自 192.168.54.14 端口 60413 ssh2 的 macmini2 的键盘交互/pam4 月 18 日 09:59:39 Macs-Mac-mini sshd:macmini2 [priv][1036]:USER_PROCESS:1040 ttys000

但现在我不知道我必须做什么来解决它.

解决方案

我已经找到了关于我的问题的解决方案.我已经完成了以下步骤:

  1. 在我的 Windows 中:我已从%localappdata%XamarinMonoTouch"中删除了内容.
  2. 在 Mac 终端中: 删除authorized_keys Mac 文件(在我的例子中是rm/Users/macmini2/.ssh/authorized_keys")
  3. 在 Mac 终端中: chmod g-w/Users/macmini2/
  4. 在 Mac 终端中: chmod 700/Users/macmini2/.ssh/
  5. 在 Mac 终端中: 创建一个空文件:/Users/macmini2/.ssh/authorized_keys(例如使用 vim)
  6. 在 Mac 终端中: chmod 600/Users/macmini2/.ssh/authorized_keys
  7. 在 Visual Studio 上: 使用 Xamarin Mac Agent 登录
  8. 在 Visual Studio 上:使用 [调试] - [iPhoneSimulator] - [iPhone 5 iOS 8.1] 运行应用程序
  9. 最后,模拟器在 Mac 计算机上运行.

此链接帮助了我.

I'm continuing my adventure with Xamarin.

I'm developing an Xamarin Forms application with a Portable Class Libraries (PCL).

I have compiled and debugged my application by Android, but now, I'm interested to run the application in iOS to test in this platform.

I have a problem with the connection between my PC and the Mac.

I have a PC (Windows 8.1) with Visual Studio Community 2015 with Xamarin tools installed.

In my Mac Mini, I have installed OS X (v10.11.3), XCode (v7.2) and Xamarin Studio. I have logged in with my Xamarin account.

In the two machines I have the same Xamarin version.

I have followed the Xamarin walkthrough.

On Visual Studio I open the Xamarin Mac Agent. It finds my Mac Mini. Then it asks me the Mac credentials (user and password).

The login works at this point.

Then, in the solution, I set the iOS project as the startup project. I clean the solution, I build again and start the compile/debug process (F5).

In this point, the output retrieves a message:

1> Connecting to Mac server Macs-Mac-mini.local...

1>C:Program Files (x86)MSBuildXamariniOSXamarin.iOS.Windows.After.targets(54,5): warning : Could not authenticate the user using the existing ssh keys

1>C:Program Files (x86)MSBuildXamariniOSXamarin.iOS.Windows.After.targets(54,5): error : Unable to connect to Address='Macs-Mac-mini.local' with User='macmini

I have used Putty (SSH Client) to check with my user/password if I'm able to connect to Mac, and I have had success.

Into /Users/macmini2/.ssh/authorized_keys file (Mac machine) each time that I use the Xamarin Mac Agent, Visual Studio adds a new key entry (it adds the same repeated).

I see that perhaps the problem is related with ssh keys. Why I have this problem? What am I doing wrong?

A thing that I have tested was openning the Xamarin project directly in Mac with Xamarin Studio, build it and run the simulator. It works.

I have seen other similar question, but I think that it doesn't have the same problem.

EDIT:

More specific information about the error when I try to compile/debug:

Could not authenticate the user using the existing ssh keys
Xamarin.Messaging.VisualStudio.MessagingAuthenticationException: Could not authenticate the user using the existing ssh keys ---> Renci.SshNet.Common.SshAuthenticationException: Permission denied (publickey).
   en Renci.SshNet.ClientAuthentication.Authenticate(IConnectionInfoInternal connectionInfo, ISession session)
   en Renci.SshNet.ConnectionInfo.Authenticate(ISession session)
   en Renci.SshNet.Session.Connect()
   en Renci.SshNet.BaseClient.Connect()
   en Xamarin.Messaging.VisualStudio.MessagingService.<ConnectAsync>d__70.MoveNext()
   --- Fin del seguimiento de la pila de la excepción interna ---

EDIT 2:

I have revised the troubleshooting Xamarin page, specifically that it says "Unable to authenticate with SSH keys. Please try to log in with credentials first".

I have run:

chmod og-w "$HOME"
grep sshd /var/log/system.log > "$HOME/Desktop/sshd.log"
cd Desktop
cat sshd.log

And the content of the file is:

Apr 18 09:23:28 Macs-Mac-mini sshd[769]: Authentication refused: bad ownership or modes for directory /Users/macmini2/.ssh
Apr 18 09:25:27 Macs-Mac-mini com.apple.xpc.launchd[1] (com.openssh.sshd.EE9A94ED-????-....-????-77254934B300[769]): Service exited with abnormal code: 1
Apr 18 09:59:39 Macs-Mac-mini sshd[1036]: Accepted keyboard-interactive/pam for macmini2 from 192.168.54.14 port 60413 ssh2
Apr 18 09:59:39 Macs-Mac-mini sshd: macmini2 [priv][1036]: USER_PROCESS: 1040 ttys000

But now I don't know what I have to do to solve it.

解决方案

I have found the solution about my problem. I have done the following steps:

  1. In my Windows: I have removed the content from "%localappdata%XamarinMonoTouch."
  2. In Mac terminal: Remove the authorized_keys Mac file ("rm /Users/macmini2/.ssh/authorized_keys" in my case)
  3. In Mac terminal: chmod g-w /Users/macmini2/
  4. In Mac terminal: chmod 700 /Users/macmini2/.ssh/
  5. In Mac terminal: Create a empty file: /Users/macmini2/.ssh/authorized_keys (with vim, for example)
  6. In Mac terminal: chmod 600 /Users/macmini2/.ssh/authorized_keys
  7. On Visual Studio: Login with Xamarin Mac Agent
  8. On Visual Studio: Run the application with [Debug] - [iPhoneSimulator] - [iPhone 5 iOS 8.1]
  9. And finally, the simulator runs on Mac computer.

This link helped me.

这篇关于我无法从 Visual Studio 2015 使用 Xamarin Mac Agent 连接到 Mac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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