I know the question has been asked a milion times but I still can't figure out why it is not working. I want to access my asp .net api from my android emulator( android studio) but I always get error 400 hostname invalid. I have looked every topic about it but it is still not working. I have add these three lines
<binding protocol="http" bindingInformation="*:51755:127.0.0.1" />
<binding protocol="http" bindingInformation="*:51755:*" />
<binding protocol="http" bindingInformation="*:51755:172.20.10.9" />
into my C:\Program Files (x86)\IIS Express\config\templates\PersonalWebServer\applicationhost.config but it is still not working.
Here is the code on android studio
AsyncHttpClient client = new AsyncHttpClient();
RequestParams parameters = new RequestParams();
parameters.put("userName","test");
parameters.put("password","test1234");
parameters.add("confirmPassword","test1234");
client.post("http://10.0.2.2:51755/api/orders",parameters, new JsonHttpResponseHandler(){
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
// Root JSON in response is an dictionary i.e { "data : [ ... ] }
// Handle resulting parsed JSON response here
text.setText(response.toString());
}
@Override
public void onFailure(int statusCode, Header[] headers, String res, Throwable t) {
// called when response HTTP status is "4XX" (eg. 401, 403, 404)
text.setText(res.toString());
}
});
I cannot figure why it is not working yet, because I followed every thing I found on every topics.