Trust Failure Http exception when making https service call in background

I am trying to make a https service request from xamarin android app. I have set http client implementation to Managed and TLS1.2+.I am able to send http requests successfully when the app is open but I am getting the below exception when the app is in background. My requirement of the app is, it should send http requests from a pending intent broadcast receiver even when the app is in background. I have tried using Android http client handler but of no use. Please help..

Here is the exception:

System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: TrustFailure (A call to SSPI failed, see inner exception.) ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED

at /Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/external/boringssl/ssl/handshake_client.c:113
at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00038] in :0
at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status) [0x0003e] in :0
at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus)
at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00006] in :0
at Mono.Net.Security.AsyncProtocolRequest+d__24.MoveNext () [0x000ff] in :0
--- End of stack trace from previous location where exception was thrown ---
at Mono.Net.Security.AsyncProtocolRequest+d__23.MoveNext () [0x0008b] in :0
--- End of inner exception stack trace ---
at Mono.Net.Security.MobileAuthenticatedStream+d__47.MoveNext () [0x00254] in :0
--- End of stack trace from previous location where exception was thrown ---
at Mono.Net.Security.MonoTlsStream+d__17.MoveNext () [0x00126] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Net.WebConnection+d__18.MoveNext () [0x001ba] in :0
--- End of inner exception stack trace ---
at System.Net.WebConnection+d__18.MoveNext () [0x0021a] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Net.WebConnection+d__19.MoveNext () [0x00141] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Net.WebOperation+d__57.MoveNext () [0x0009a] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Net.WebCompletionSource1+<WaitForCompletion>d__15[T].MoveNext () [0x00094] in <fb6d78e506844b3b96d5b35aa047fbbd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Net.HttpWebRequest+<RunWithTimeoutWorker>d__2411[T].MoveNext () [0x000f8] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x002e7] in <25ebe1083eaf4329b5adfdd5bbb7aa57>:0
--- End of inner exception stack trace ---
at System.Net.Http.HttpClientHandler+d__64.MoveNext () [0x00478] in <25ebe1083eaf4329b5adfdd5bbb7aa57>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Http.HttpClient+d__49.MoveNext () [0x000ca] in <25ebe1083eaf4329b5adfdd5bbb7aa57>:0
--- End of stack trace from previous location where exception was thrown ---
at LocationUpdates.Droid.Utils+d__9.MoveNext () [0x00114] in <01218f6df2e74843925883a289943802>:0

Sign In or Register to comment.