如何诊断来自 Web API 的缓慢 HTTPS 请求

How to diagnose slow HTTPS requests from Web API

我在 Windows Server 2012 R2 上有一个 Web API(ASP.NET Core 3.0,IIS 6.2)。当它向外部 SOAP API 发出 HTTPS 请求时,我在 20 秒后收到代码为 500 的响应。我的 API 在日志中写道:

The operation timed out

异常堆栈跟踪的尾部:

at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)\r\n at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)\r\n at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.b__0(IAsyncResult asyncResult)\r\n--- End of stack trace from previous location where exception was thrown ---

我通过 SoapUI 从同一台服务器向外部服务器重复我的 API 请求。 2-3秒后成功。我的网站 API 也可以在我的另一台服务器上运行。

不幸的是,我不知道如何找出问题的原因。你能告诉我一些想法吗?

我找到了解决办法。我刚刚从 4.4.0 更新了 nuget 包 System.ServiceModel.*,WCF 请求现在可以正常工作了。

https://github.com/dotnet/wcf/issues/2368