Search code examples
azureazure-web-app-servicewebapiazure-webjobs-continuous

Call Azure API from WebJob/ Shared code between WebJob and web API


I have a web API in an ASE and an associated web job. I am trying to call this web API from the web job but it always fails with:

winhttpexception: a security error has occurred.

I have put in all the tls related settings but still getting the error. Any suggestions on the error? Also is there a way to share code between WebJob and web API?


Solution

  • I was able to resolve the issue by setting the below in my code.This resolved the Security Error.

    using(var handler = new HttpClientHandler
    {
       ServerCertificateCustomValidationCallback = (sender,certificate,chain,sslPolicyErrors) => true
    })