我已经在Linux上的Nginx服务器上部署了.net核心api。我的api使用HTTPClient.PostAsJsonAsync方法在内部调用第三方api。
系统在正常负载下可以正常工作,但是在负载较重的情况下,我将遇到错误。
System.Net.Http.HttpRequestException:无法分配请求的地址---> System.Net.Sockets.SocketException:无法在System.Net.Http.ConnectHelper.ConnectAsync(字符串主机,Int32端口, CancellationToken CancellationToken)\ n ---内部异常堆栈跟踪的结尾--- \ n在System.Net.Http.ConnectHelper.ConnectAsync(字符串主机,Int32端口,CancellationToken cancellingToken)\ n在System.Threading.Tasks.ValueTask { {1}} 1.get_Result()\ n在System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask 1.get_Result()\n at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n at System.Threading.Tasks.ValueTask
1.get_Result()\ n在System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage请求,布尔值doRequestAuth,CancellationToken cancelestToken)\ n在System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request,CancellationToken cancelleToken)\ n在System.Net.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask,HttpRequestMessage request,CancellationTokenSource cts,Boolean disposeCts )\ n在M yCard.Middleware.Controllers.DefaultController.CallAndGetESBResponse(Object requestModel,API apiInfo)
有人可以帮助我解决这个问题吗?拜托。