0
votes

I'm aware, that this exceptions are discussed in several other threads, but I can't get mine to work. My environment: I Have a ASP.NET Core REST-API (let's call it A), which calls another REST-API (let's call it B). Working with these two APIs, I have a Server in the internal network and my local development environment, also making use of Postman. Trying out the combiniations, I have the following behavior:

  • Local A calls local B --> Works
  • Local A calls Server B --> Error
  • Postman calls Server B --> Works
  • Server A calls Server B --> Error

Calls to A work locally and on the Server.

The error I get:

{System.Net.WebException: An error occurred while sending the request. A security error occurred ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.WinHttpException: A security error occurred at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at

Looking deeper, the most inner exception is

"A security error occurred"

If I didn't use Postman, I would just assume, that something regarding the IIS on the Server, where B is running. But since Postman can in fact work with it, this doesn't seem to be the problem. Also, since everything is running fine on the local environment, there has to be something on the server. Intereresting enough, A and B are running on the same one.

That error is about useless, huh? I would guess that this may be a CORS thing, but I would imagine a better error message if that was the case. Perhaps a firewall/port issue?R. Richards
CORS only matters on the front-end. Can't be the issue for a .NET exception.juunas
Are any of the servers using self-signed TLS certificates? Or are you using Fiddler and the HTTPS "snooping" certificate it installs? IIRC, the error you describe has happened to me before when a TLS certificate was bad.Nate Barbettini