从另一台设备访问 Azure 模拟器 [英] Accessing Azure Emulator from Another Device

查看:20
本文介绍了从另一台设备访问 Azure 模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同的项目:

  1. Windows Phone 8 应用程序,我在真实的物理开发设备上运行.
  2. Azure Cloud 服务,其中包含一个包含 ASP.NET MVC WebAPI 的简单 WebRole 端点.

我的目标很简单:
使用从真实设备运行的 WP8 应用程序,在部署到 Azure 模拟器时访问(使用 HTTPClient)WebAPI 控制器.

My goal is simple:
Use the WP8 Application running from a real device, to access (using HTTPClient) the WebAPI controller while it is deployed to the Azure Emulator.

要做的工作是:

  1. 当应用程序部署在 Azure 云上时,它可以成功地与 WebApi 通信.
  2. 当应用程序本地托管在 IIS Express(没有 Azure)上时,应用程序可以成功地与 WebApi 通信,并且 IIS Express 设置在 这篇文章.
  1. The application can successfully communicate with the WebApi when it is deployed on Azure Cloud.
  2. The application can successfully communicate with the WebApi when it is hosted locally on IIS Express (Without Azure), and the IIS Express settings are changed following this article.

据我所知,问题在于 Azure 模拟器配置为侦听 IP 地址 127.0.0.1,无法从 localhost 域外部访问.

As far as I understand, the problem is that the Azure Emulator is configured to listen on IP address 127.0.0.1, which is not accessible from outside the localhost domain.

我发现这个 post 为这个确切的问题提供了解决方案,但我试图遵循尝试部署到 Azure 模拟器时会导致未知异常.

I found this post that offers a solution to this exact problem, but trying to follow it results in an Unknown Exception while trying to deploy to Azure Emulator.

本地测试与 Azure 云服务通信的 WP8 应用真的不可能吗?

Is it really impossible to locally test WP8 application that communicates with Azure Cloud Service?

推荐答案

我想出了如何让电话模拟器或连接的物理 Windows Phone 设备与 Azure 模拟器通信.

I figured out how it is possible to have a Phone Emulator or an attached physical Windows Phone device communicating with the Azure Emulator.

对于遇到相同要求的其他开发人员,以下是使其工作所需的步骤:

For other developers struggling with the same requirement, here are the steps required for it to work:

  1. 您知道主机的 IP 地址.
  2. 没有防火墙阻止访问
  3. 关闭 IIS 和 Azure 模拟器并在配置更改后重新启动它们

Azure 计算模拟器:

  1. 打开C:Program FilesMicrosoft SDKsWindows AzureEmulatordevfabricDevFC.exe.config"进行编辑.
  2. "VipPoolStartIPAddress""VipPoolEndIPAddress" 设置为您的主机 IP(例如 192.168.1.100)
  1. Open "C:Program FilesMicrosoft SDKsWindows AzureEmulatordevfabricDevFC.exe.config" for editing.
  2. Set "VipPoolStartIPAddress" and "VipPoolEndIPAddress" to your hosting machine IP (e.g. 192.168.1.100)

Azure 存储模拟器:

  1. 同时打开 "C:Program FilesMicrosoft SDKsWindows AzureEmulatordevstoreDSServiceLDB.exe.config""C:Program FilesMicrosoft SDKsWindowsAzureEmulatordevstoreDSServiceSQL.exe.config" 进行编辑.
  2. 两个文件中的services部分设置为使用托管IP.
  3. 在角色"设置中配置存储连接字符串(而不是默认的 Windows Azure 存储模拟器 设置):
    • 右键单击Role(在解决方案资源管理器中的Roles"文件夹下)进入它的Properties 页面.点击设置标签.确保您编辑了 Local 设置(在 Service Configuration 选择框中选择它).
    • 编辑存储的连接字符串
    • 手动输入凭据
    • 帐户名称和帐户密钥写在 DSServiceSQL.exe.config
    • 中的 accounts 部分下
    • 使用您的托管 IP 指定自定义端点.
  1. Open both "C:Program FilesMicrosoft SDKsWindows AzureEmulatordevstoreDSServiceLDB.exe.config" and "C:Program FilesMicrosoft SDKsWindows AzureEmulatordevstoreDSServiceSQL.exe.config" for editing.
  2. Set the services section in both of the files to use hosting IP.
  3. Configure the Storage Connection String in the "Role" settings (instead of default Windows Azure storage emulator setting):
    • Right click on the Role (under "Roles" folder in the solution explorer) to enter it's Properties page. Click on Settings tab. Make sure you edit the Local settings (Select it on Service Configuration selection box).
    • Edit the Connection String for the storage
    • Manually enter credentials
    • Account name and account key are written under accounts section in DSServiceSQL.exe.config
    • Specify custom endpoints, with your hosting IP.

享受吧!

这篇关于从另一台设备访问 Azure 模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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