question

VuyiswaMaseko-8882 avatar image
0 Votes"
VuyiswaMaseko-8882 asked ajkuma-MSFT edited

Javax.Net.Ssl.SSLHandshakeException: Trust anchor for certification path not found.

i have tested my SSL against https://www.digicert.com/help/ and got a green Light

"Congratulations! This certificate is correctly installed."

and my api's get this error


Javax.Net.Ssl.SSLHandshakeException: Trust anchor for certification path not found.
Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue
args) [0x0006e] in <bd6bd528a8784b7caf03e9f25c9f0d7b>:0*

this happens in OS:Android 11 , my code is as below


 public async Task<List<USERS>> Get_All_Customers( )
          {
        
              List<USERS> results = null;
              try
              {
                  USERS m_model = new USERS
                  {
                      USER_ID = 1,
                      CURRENT_DATETIME = '2021/07/01'
                  };
                  var httpClient = new HttpClient();
        
                  httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                         
                         
                  var Json = JsonConvert.SerializeObject(m_model, new JsonSerializerSettings
                  {
                      ContractResolver = new DefaultContractResolver
                      {
                          IgnoreSerializableAttribute = false
                      }
                  });
        
        
                  HttpContent httpContent = new StringContent(Json, Encoding.UTF8, "application/json");
                  httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8");
        
                  var response = await Task.Run(() => httpClient.PostAsync(string.Format("https://www.myserver.com/api/MainCustomers_OnlineDates/Get_All_Customers"), httpContent));
        
                  if (response.StatusCode == System.Net.HttpStatusCode.OK)
                  {
                      var content = await response.Content.ReadAsStringAsync();
                      results = JsonConvert.DeserializeObject<List<USERS>>(content);
                  }
              }
              catch (Exception ex)
              {
                  await Task.Run(() => Crashes.TrackError(ex));
              }
        
              return results;
          }



Thanks


dotnet-xamarinformsvs-generalazure-webapps-ssl-certificatesvs-msbuilddotnet-aspnet-webapi
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for posting the question here.

Since you have posted the question on azure-webapps tag, are you leveraging Azure App Service WebApp?

To receive insights from the targetted audience/SMEs on App center questions/issue, you may also just post your question here:
https://github.com/microsoft/appcenter/issues and Help and feedback

I have added additional tags for other communities visibility.


0 Votes 0 ·

0 Answers