Android Emulator 环回 IIS Express 不起作用,但可以与 Cassini 一起使用 [英] Android Emulator loopback to IIS Express does not work, but does work with Cassini

查看:33
本文介绍了Android Emulator 环回 IIS Express 不起作用,但可以与 Cassini 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将数据从在我本地机器上的 Android Emulator 中运行的 Android 应用程序发布到在 IIS Express 下运行的 Web 应用程序,该应用程序也在我的本地机器上运行.不幸的是,当我从模拟器发布到 10.0.2.2 时,我收到了 Host Not Found 错误消息.

I am attempting to post data from an Android application running in the Android Emulator on my local machine to a web application running under IIS Express also running on my local machine. Unfortunately, when I post to 10.0.2.2 from the emulator I receive a Host Not Found error message.

如果我将 Web 应用程序配置为在 ASP.NET Dev Server (Cassini) 而不是 IIS Express 下运行,则 Android 应用程序可以毫无问题地发布.对于 IIS Express,我缺少什么配置会阻止它使用来自 Android 模拟器的环回?

If I configure the web application to run under ASP.NET Dev Server (Cassini) instead of IIS Express the Android application is able to post with no problems. What configuration am I missing for IIS Express that is preventing it from working with a loopback from the Android emulator?

推荐答案

授予自己绑定到 localhost 以外的网络适配器的权限,并配置 IIS express 以绑定到所有适配器.

Grant yourself permission to bind to network adapters other than localhost, and configure IIS express to bind to all adapters.

IIS Express 随后将接受来自 Android 模拟器的通过 10.0.2.2 的连接.如果您向防火墙添加规则,您还可以将 IIS Express 暴露给您的网络,这会降低安全性,但对于测试物理设备很有用.

IIS Express will then accept connections from the Android emulator via 10.0.2.2. If you add a rule to the firewall, you can also expose IIS Express to your network, which decreases security but is useful for testing physical devices.

步骤详情:(假设端口号为 5555 - 请改用您的实际端口)

Step details: (they assume a port number of 5555 - use your actual port instead)

  1. 以管理员身份从命令提示符运行:

  1. Run this from a command prompt as Administrator:

netsh http 添加 urlacl url=http://*:5555/user="NT AUTHORITYINTERACTIVE"

%USERPROFILE%DocumentsIISExpressconfigapplicationhost.config 中,将您网站的 localhost 绑定替换为 bindingInformation="*:5555:*".结果应如下所示:

In %USERPROFILE%DocumentsIISExpressconfigapplicationhost.config, replace your site's localhost binding with bindingInformation="*:5555:*". The result should look like this:

    <site name="..." id="...">
        <!-- application settings omitted for brevity -->
        <bindings>
            <binding protocol="http" bindingInformation="*:5555:*" />
        </bindings>
    </site>

这篇关于Android Emulator 环回 IIS Express 不起作用,但可以与 Cassini 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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