I am trying to write a Web Api using Asp.Net core that acts as a Data Access Layer for my Xamarin Application for android. I am trying to access the web API from my android emulator, but I get an exception saying "Error: TrustFailure (Authentication failed, see inner exception.)". The inner exception says "Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED\n at /Users/builder/jenki…".
I created the Asp.net Api project with no authentication enabled, and I'm confused why I am still getting this error. How do I solve this?
I am using ISS Express to run my API project since using the command line results in my client app on my android emulator timing out instead of throwing the aforementioned exception (not sure why, but that's a different issue).
I read online that IIS uses certificate authentication by default. But if I chose no authentication when creating the project, I thought that should bypass any authentication used by IIS when the api is called. I don't mind if users aren't getting authentication as there is no sensitive data being accessed. However, I also wouldn't mind using a username/password form of authentication, but I just couldn't figure out how to do it.
Here is my client code calling the api:
WebClient web = new WebClient();
try
{
var data = web.DownloadData(
"https://192.168.1.233:44346/Item");
}catch(Exception e)
{
throw;
}
And here is my code in the controller for the ASP.NET Api:
[HttpGet]
public IEnumerable<Item> GetItems()
{
return
itemGetter.GetItems();
}
itemGetter
is just a getter for my Item
class that returns hardcoded data. The code isn't reaching this part at all.