search

Home  >  Q&A  >  body text

android访问网络400:hostname is not valid?

1.服务使用.net mvc5实现;
2.使用真机调试;
3.测试url为:http://192.168.0.113:1234/member/login

在浏览器中访问正常,使用android请求,报错:400 the hostname is not valid.

android代码为:

java        HttpPost request = new HttpPost("http://192.168.0.113:1234/member/login");
        request.setHeader("Content-Type", "application/x-www-form-urlencoded");
        request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
        HttpResponse httpResponse = new DefaultHttpClient().execute(request);
        return EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
PHP中文网PHP中文网2773 days ago703

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 13:50:03

    The problem has been found, no care.

    is a program that runs in the iis express environment of vs. In this way, the site cannot be accessed in a LAN environment.

    reply
    0
  • Cancelreply