I have made a localhost web service in visual studio, Very simple with just one [WebMethod
] just to make a connection happen. Xamarin Android.
It looks like this:
[WebMethod]
public string ReturnPersonName()
{
return "Donald Trump";
}
And im my other project all I want is to put this return into a variable and put it in a text box so its visible when I run the app.
PersonnelWS.WebService1 personnelWS = new PersonnelWS.WebService1();
Console.Writeline(personnelWS.ReturnPersonName());
The error I get is:
System.Net.WebExceptionStatus.ConnectFailure: "Error: ConnectFailure (Connection refused)"
All the fixes I tried were:
Changing the IP address in the binding protocol tags to 127.0.0.1:<port>
Adding the INTERNET
permission to my manifest.
Dont have anywhere to enter the magic IP that is 10.0.2.2
Tried it in the proxy settings of the emulator, but proxy is unreachable. And if I put this IP instead of the URL of the I get a AuthenticationFailed error
.
How do I establish connection between my emulator or rather allow my emulator to access the web service?
CodePudding user response:
Configured my Visual Studio to a Local IIS, and in my IIS manager set the webservice to my IPV4 address, and tested it in SoapUI and Android Emulator and it works properly.