eric pregnon
eric pregnon

Reputation: 1

How to consume a remote web api in IIS server with an android maui application

I have created a web api and installed it into a web server under iis. I used it with a windows maui application and all is OK. I cannot consume the web api with the maui android app . As usual I use

var httpClient = new HttpClient();
var BaseUrl = DeviceInfo.Platform == DevicePlatform.Android
    ? "http://10.0.2.2:5257"
    : "http://api_test:5257";
var response = await httpClient.GetAsync($"{BaseUrl}/api/Cds");
var data = await response.Content.ReadAsStringAsync();

This config (10.0.2.2) works fine with a local web api but not with remote

I have tried to replace the 10.0.2.2 with the iis web server, or allow all ip. Nothing runs OK.

as the ip 10.0.2.2 is mandatory,I would like to know how to route the http command from 10.0.2.2 to the iis web server.

Upvotes: 0

Views: 124

Answers (0)

Related Questions