title: failed to connect to localhost/127.0.0.1 android
body: <p>I am new to android development, and trying to call local .NET web api service in android via retrofit library. After starting my web api on IIS I am getting this error failed to connect to localhost/127.0.0.1 android.</p>
  
  <p>When I did same thing as suggested <a href="http://themakeinfo.com/2015/04/retrofit-android-tutorial/" rel="noreferrer">http://themakeinfo.com/2015/04/retrofit-android-tutorial/</a>, It's working fine, But my localhost service is not calling up from android</p>
  
  <p>My service url is,
  <a href="http://localhost:52511/api/Values/getAllStudents/5" rel="noreferrer">http://localhost:52511/api/Values/getAllStudents/5</a></p>
  
  <p>and it is giving me output in XML format in browser too.</p>
  
  <p>I have also try to call it with,</p>
  
  <pre><code>public interface gitapi {
      @GET("/api/Values/GetProduct/{id}")      //here is the other url part.best way is to start using /
      public void getFeed(@Path("id") int id, Callback&lt;gitmodel&gt; response);
  }
  
  public class gitmodel {
      public int studentId;
      public String studentName;
      public String studentAddress;
  }
  
  
  String API = "http://10.0.2.2:52511";
  public void CallService(View view){
  
          RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(API).build();
          gitapi git = restAdapter.create(gitapi.class);
  
          int id = 5;
          git.getFeed(id, new Callback&lt;gitmodel&gt;() {
              @Override
              public void success(gitmodel gitmodel, Response response) {
                  Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_LONG).show();
              }
  
              @Override
              public void failure(RetrofitError error) {
                  Toast.makeText(getApplicationContext(), "Errors", Toast.LENGTH_LONG).show();
              }
          });
  }
  </code></pre>
  
  <p>but no luck.</p>
  
  <p>Please tell me where do I need to change to make it work. ?</p>
  
  <p>Response I am getting in browser is,</p>
  
  <pre><code>&lt;ArrayOfstudents xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/APICall.Controllers"&gt;
  &lt;students&gt;
  &lt;studentAddress&gt;valsad&lt;/studentAddress&gt;
  &lt;studentId&gt;1&lt;/studentId&gt;
  &lt;studentName&gt;Keval&lt;/studentName&gt;
  &lt;/students&gt;
  &lt;students&gt;
  &lt;studentAddress&gt;Hyderabad&lt;/studentAddress&gt;
  &lt;studentId&gt;2&lt;/studentId&gt;
  &lt;studentName&gt;Honey&lt;/studentName&gt;
  &lt;/students&gt;
  &lt;/ArrayOfstudents&gt;
  </code></pre>