0

I have to implement a Web Service in a Xamarin Project. So I create a simple Web Service to do some test. There is the code I used to :

using (HttpClient client = new HttpClient()) {
                client.BaseAddress = new Uri("http://localhost:62056/");
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = client.GetAsync("DataTransferTest.svc/HelloWorld").Result;
                string json = response.Content.ReadAsStringAsync().Result;    
}

I already try to change the http://localhost:62056/ to http:10.0.0.2:62056 but nothing change.

I already configure my ISS express like this :

<site name="LogiStock.WebServices2" id="4">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="D:\TeamExplorer\LogiStock-1.0.1\LogiStock.WebServices2" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:62056:localhost" />
                    <binding protocol="http" bindingInformation="*:62056:192.168.90.139" />
                    <binding protocol="http" bindingInformation="*:62056:127.0.0.1" />
                </bindings>
            </site>

There is the error I got when i'm trying this code :

One or more errors occured. An error occured while sending the request _Error: ConnectFailure (Connection refused) _Connection refused

I really hope that someone can help me, I really don't know what is wrong..

Kuldeep Kulkarni
  • 796
  • 5
  • 20
Alexandre S.
  • 522
  • 2
  • 5
  • 24

1 Answers1

0

Just to make sure, you have the following line in your manifest file?

<uses-permission android:name="android.permission.INTERNET" /> 
zpouip
  • 787
  • 5
  • 11