Base solution for your next web application
Open Closed

What is correct URL for MAUI DefaultHostUrl? #12367


User avatar
0
JeffMH created

When I try to set the DefaultHostUrl to our API URL, I get an error from Flurl. Example URL is https://api.mydomain.com/

What should the URL be? Should it point to the API, the Angular site, something else? I thought it would be the API, but the error occurs. Maybe it should be https://api.mydomain.com/api/v1 or something similar? Documentation isn't clear - it says to point to https://localhost:port and that's all.

Error occurs here at call.Response (I added the null coalescing operator, just in case):

image.png

In this instance, Response is null. It appears the correct URL is being called, or what I think is correct.

Thanks in advance!


3 Answer(s)
  • User Avatar
    0
    JeffMH created

    More info:

    image.png

    image.png

    image.png

    image.png

    image.png

    image.png

  • User Avatar
    0
    JeffMH created

    Found the issue - the Android emulator's internet connection details can become corrupted, requiring a factory reset, or a DNS change to 8.8.8.8.

    However, this should have been caught by CrossConnectivity. It would be good if an internet connectivity check was made and an appropriate error message like "You are not connected to the Internet." would be shown.

    The emulator DOES get an IP Address from the fake Android Wi-Fi and fake T-Mobile connection. However, it doesn't have Internet, and Android OS does make that information available. Can you make sure the following code is being properly used / verifying network connectivity, please?

    image.png

    In WebRequestExecter, Line 35.

    If I find a fix I'll post it, too :) Thanks!

  • User Avatar
    0
    JeffMH created

    Looking into CrossConnectivity, you can use IsRemoteReachable(ApiUri) before making the call.