400错误的请求从Android访问ASP.NET MVC 4应用程序 [英] 400 bad request accessing ASP.NET mvc 4 application from android

查看:96
本文介绍了400错误的请求从Android访问ASP.NET MVC 4应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行在Android模拟器上的phonegapp应用,我想访问我的ASP.NET MVC 4服务器以发出登录请求.

I have a phonegapp App running on an Android emulator and I would like to access my ASP.NET MVC 4 server in order to make a log in request.

问题是我的仿真器无法访问IIS应用程序. 我尝试了这个:

The problem is that my Emulator can't access my IIS application. I tried this :

  1. 使用10.0.2.2:port从android导航器中引用我的网站.
  2. 使用我的本地IP地址(192.168.0.1:port)
  3. 禁用我的防火墙
  4. 在IISExpress中的配置文件中更改绑定

尽管如此,我还是收到了"400错误的请求错误无效的用户名" ...

Despite of that, i've got a "400 bad request error invalid username"...

有人可以帮助我吗?

推荐答案

我遇到了同样的问题. android模拟器无法识别url中的端口号.因此,我们打开Visual Studio项目设置后,将IIS设置更改为在本地主机(例如"localhost/testPorject")下有一个虚拟目录,而不是"localhost:PortNumer".这行得通,仿真器识别出它.

I had the same problem. the port number in url isn't recognized by android emulator. so wehn I open visual studio project settings, I changed the IIS settings to have a virtual directory under the local host (for example "localhost/testPorject") instead of "localhost:PortNumer". this worked and the emulator recognized it.

这篇关于400错误的请求从Android访问ASP.NET MVC 4应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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