主机名无效 - 无法从Android模拟器连接IIS前preSS [英] Invalid HostName - Not able to connect IIS express from Android Emulator
问题描述
我试图连接我的本地IIS前preSS从Android应用程序托管的WCF服务。目前,我在模拟器上测试这个。
I am trying to connect a WCF service hosted at my local IIS express from an Android app. Currently, I am testing this on an Emulator.
为服务本地URL是的http://的locahost:40000 / API /身份验证
我知道本地主机是行不通的,我在code使用10.0.2.2
I knew that localhost is not going to work and I used 10.0.2.2 in the code
post = new HttpPost("http://10.0.2.2:40000/api/authenticate");
但在客户端执行的响应是无效的主机名
but the response on client execute is an "Invalid Hostname"
我试过编辑IIS的对ApplicationHost.config前preSS并添加绑定条目10.0.2.2,但没有奏效过。
I tried editing the ApplicationHost.config of IIS express and added a binding entry for 10.0.2.2 but that didn't work too
还有什么,我很想念?
推荐答案
我试过别的东西它的工作,我添加了IIS防爆preSS ApplicationHost.config文件绑定部分中我的系统的IP地址。
I tried something else which worked , I added the IP address of my system within the IIS Express applicationhost.config file bindings sections.
<bindings>
<binding protocol="http" bindingInformation="*:40000:localhost" />
<binding protocol="http" bindingInformation="*:40000:192.168.5.118" />
</bindings>
我现在能够调用服务
I am able to call the service now
这篇关于主机名无效 - 无法从Android模拟器连接IIS前preSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!