在本地调试Xamarin Sports示例 [英] Debug Xamarin Sports Sample Locally
问题描述
我在开发机器上本地调试Xamarin Sports Sample时遇到麻烦,因此我可以在同一台机器上调试移动应用程序和服务.
I am having trouble debugging the Xamarin Sports Sample locally on my development machine, so I can debug both the mobile app and the services on the same machine.
我已在Visual Studio 2015中打开了解决方案.我创建了Google API凭据,并使用该信息更新了设置.我将Azure域设置为我的本地IP地址(也尝试使用localhost和假域名).我添加了授权的javascript来源,并使用IP,本地主机和假域名的各种组合将URI重定向到Google界面.
I have got the solutions open in Visual Studio 2015. I created my Google API Credentials and updated the settings with that info. I set the Azure domain to my local IP address (also tried localhost and a fake domain name). I added the authorized javascript origins and redirect URI's into the Google interface with the various combinations of IP, localhost and fake domain name.
看起来重定向URI不能是IP地址.我尝试将伪造的域名放入主机文件.我可以运行服务解决方案,它会正确显示在浏览器中.我可以在浏览器中点击/login/google
,它看起来可以正常工作.
It looks like the redirect URI cannot be an IP address. I have tried putting the fake domain name into my hosts file. I can run the services solution and it displays in the browser properly. I can hit /login/google
in the browser and it looks like it works.
当我在模拟器中运行移动解决方案并单击登录"按钮时,出现错误.在进行故障排除期间,我发现了各种错误,例如名称无法解析以及其他一些错误.我怀疑可以修改设备仿真器的主机文件以包含假域名,但是即使尝试重新安装adb,我也无法使文件系统为可读写的.该命令说它成功,但是adb push告诉我该文件是只读的.
When I run the mobile solution in the emulator and click the login button, I get errors. During my troubleshooting, I have seen various errors, like name not resolved and a few others. I suspected that I could modify the device emulators hosts file to include the fake domain name, but I am not able to get the file system to be read-write, even after trying adb remount. That command says it was successful, but the adb push tells me the file is read-only.
如果这很重要,我正在使用Nexus 6 API 23虚拟设备.
I am using a Nexus 6 API 23 virtual device, if that matters.
是否有人设法获得了此示例以在本地调试移动设备和服务?关于如何修改主机文件以查看是否可行的任何建议?关于将其全部在本地运行还有其他想法吗?
Has anyone managed to get this sample to debug both mobile and services locally? Any suggestions on how I can modify the hosts file to see if that works? Any other thoughts on getting this to all run locally?
我还没有尝试运行iOS项目.那会遇到同样的挑战吗?
I have not tried running the iOS project, yet. Will that run into the same challenges?
推荐答案
您的设备/仿真器可能无法访问您的服务器计算机.检查您的服务器本地主机ip,然后以管理员身份使用PowerShell运行它:
Your device/emulator probably doesnt´t have access to your server machine. Check your server local host ip, and run this with PowerShell as administrator:
netsh http add urlacl url=http://192.168.X.X:XXXX/ user=everyone
用主机ip和应用程序端口替换ip:port.然后在 applicationhost.config
中创建一个新的< Binding>
,指向上面的ip:port.
Replace the ip:port with your host ip and the app port.
Then create a new <Binding>
in your applicationhost.config
pointing to the above ip:port.
More details (and possible duplicate) here: How to call your own ASP.NET MVC project preaent on same machine from xamrin webview
这篇关于在本地调试Xamarin Sports示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!