如何访问从Visual Studio模拟器为Android在IIS前preSS本地部署的服务 [英] How to access a service deployed locally in IIS express from Visual studio emulator for android

查看:733
本文介绍了如何访问从Visual Studio模拟器为Android在IIS前preSS本地部署的服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有哪些得到我的机器上本地部署 HTTP一个的WebAPI项目://本地主机:6143 或< A HREF =htt​​p://127.0.0.1:6143相对=nofollow> http://127.0.0.1:6143 。

I'm have a WebApi project which gets deployed locally on my machine as http://localhost:6143 or http://127.0.0.1:6143.

然而,当我尝试浏览在Visual Studio模拟器Android浏览器的终端,我得到网:犯错连接超时。

However when I try to browse to that endpoint on the visual studio emulator for android browser, I get net:err connection timed out.

请注意,我使用 http://10.0.2.2:6143 因为本地主机荣获模拟器在模拟器将不起作用(因为它是一个虚拟机,本地主机是指本身)。

Note that on the emulator I'm using http://10.0.2.2:6143 since localhost won't work on the emulator (since it's a vm, localhost refers to itself).

我也试过127.0.0.1:6143并获得拒绝连接。

I've also tried 127.0.0.1:6143 and get connection refused.

我还添加了端口6143的传入防火墙规则。

I also added port 6143 to the incoming firewall rules.

奇怪的是,通过xamarin工作非常好,没有配置问题,安装的其他模拟器。

Weird thing is that the other emulators installed by xamarin work very well with no configuration issues.

任何线索为什么不起作用?我所有的搜索和方法至今未能。

Any clues why this doesn't work? All my searches and approaches have failed so far.

推荐答案

一些狩猎后想通了这一点。

Figured this out after some hunting.

在2015年VS,对于ASP .NET项目ApplicationHost.config文件不再位于文档\\ IISEx preSS文件夹中。现在在你的项目的根在.VS \\ Config中。

In VS 2015, the applicationhost.config file for asp .net projects is no longer located in the Documents\IISExpress folder. It's now in your project root at .vs\Config.

在我想通了这一点,解决的办法很简单。我走进了配置,并增加了绑定如下(由于某种原因,这是从我原来的职位是隐藏的)

Once I figured that out, the solution was easy. I went into the config and added a binding as follows (for some reason this was hidden from my original post)


  1. 找到你的网站/ webrole在配置文件中的网站元素。它是这样的:

  1. Locate the sites element in the config file for your website/webrole. It's something like:

`<site name="MySite.Service.WebRole" id="3">`


  • 添加一个新的绑定元素

  • Add a new binding element

    &LT;绑定协议=HTTPbindingInformation =*:6153:myMachineName/&GT;

    就是这样。现在模拟器内,我就可以访问的http:// myMachineName:6153 访问服务。

    That's it. Now within the emulator, I can just access http://myMachineName:6153 to access the service.

    这篇关于如何访问从Visual Studio模拟器为Android在IIS前preSS本地部署的服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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