Asp.Net Core: Calling another REST-Api throws WebException

瘦欲@ 提交于 2019-12-12 03:08:49

问题


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.

|improve this question

来源:https://stackoverflow.com/questions/42177825/asp-net-core-calling-another-rest-api-throws-webexception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!