我已經看到其他人發布了類似的問題,并沿著使用以下代碼片段的路線走
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls |
SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls12 |
但是,我仍然遇到以下情況的問題。
我有一個在 Windows Server 上的 IIS 上運行的 Web 應用程式(一個 EC2 實體 Win 2019 服務器)和一個在 Kestrel 上運行的微服務。如果我 RDP 到 Win Server 并打開 Chrome/Firefox/Edge,我可以導航到微服務,進行基本的 API 呼叫并查看資料回傳。但是,當 IIS 應用程式嘗試訪問 API 時,我的日志中出現以下錯誤
InnerException:
> Type: HttpRequestException
> Message: An error occurred while sending the request.
> Data: 0 entries
> Stack trace:
---------------- InnerException: Type: WebException Message: The request was aborted: Could not create SSL/TLS secure >channel. Data: 0 entries Stack trace:
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
InnerException is null
證書有效/受信任/安全。所以那里沒有問題。
我假設當請求來自 IIS 中的 Web 應用程式并嘗試訪問 API 時,它不喜歡什么?有沒有辦法獲得有關我為什么會收到例外的更多資訊
uj5u.com熱心網友回復:
看起來這是答案 https://trailheadtechnology.com/solving-could-not-create-ssl-tls-secure-channel-error-in-net-4-6-x/
我希望這可以節省一些時間和頭痛
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/424699.html
標籤:C# 网 ssl iis windows-server-2019
