0
votes

I have a Xamarin.Forms mobile app, this one contains a WebView. This WebView URL should be my local development machine because I have a web app running there.

So, when running the Android Emulator, I try to use the loopback address, https://10.0.2.2:44390 ... but the WebView remain white!

I have read the following docs, but it does not help:

https://docs.microsoft.com/en-us/xamarin/cross-platform/deploy-test/connect-to-local-web-services

https://medium.com/@noumaan/ssl-app-dev-a2923d5113c6

https://developer.android.com/studio/run/emulator-networking

This doc seems to focus on accessing a WebAPI, with a HttpClient, but I'm not sure that this scenario is correct for the WebView.

Noticed that from 'Chrome android', I got the following message: 'HTTP Error 400. The request hostname is invalid'. I got the following dialog:

enter image description here

Does my Blazor app (using a self-signed certificate) should use '10.0.2.2' instead of 'localhost' by example ?

If someone has any idea, really welcome :-)

1
use the actual IP of your server - Jason
Thanks, I have already try, without luck, it does not work this way! - ClubberLang
if the IP of your server doesn't work then there is something wrong with your networking setup. Can you connect from Chrome on the emulator? - Jason
I mainly use the Android loopback, 10.0.2.2, which should point to my 'windows localhost'. I will edit my question to add some details! - ClubberLang

1 Answers

0
votes

In your applicationhost.config change in the bindingInformation the 'localhost' to '127.0.0.1'. That solved it for me. See this answer where I found the solution.