Hello,
This SSL error is expected. It is explained in detail in the official Maui documentation on using local Https services on mobile devices.
Attempting to invoke a local secure web service from a .NET MAUI app running in an Android emulator will result in a
java.security.cert.CertPathValidatorException
being thrown, with a message indicating that the trust anchor for the certification path hasn't been found. Similarly, attempting to invoke a local secure web service from a .NET MAUI app running in an iOS simulator will result in anNSURLErrorDomain
error with a message indicating that the certificate for the server is invalid. These errors occur because the local HTTPS development certificate is self-signed, and self-signed certificates aren't trusted by Android or iOS. Therefore, it's necessary to ignore SSL errors when an app consumes a local secure web service.
For details on how to connect to the local https service using a local device, please refer to the detailed steps in the following document.
A .NET MAUI app running in the Android emulator or iOS simulator can consume an ASP.NET Core web service that's running locally over HTTPS. The process to enable this is as follows:
- Trust the self-signed development certificate on your machine. For more information, see Trust your development certificate.
- Specify the address of your local machine. For more information, see Specify the local machine address.
- Bypass the local development certificate security check. For more information, see Bypass the certificate security check. Each item will be discussed in turn.
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.