問題描述
HTTPS 客戶端/服務器通信錯誤:底層連接已關閉:發送時發生意外錯誤 (HTTPS Client/Server Communication Error: The underlying connection was closed: An unexpected error occurred on a send)
在將 XML 發送到端口 443 上的 HTTPS 偵聽器時,我收到以下錯誤。偵聽器(C# 控制台應用程序)僅使用客戶端發送的相同 XML 進行響應(一個簡單的 win 表單應用程序)。如果我將偵聽器應用程序更改為 HTTP 而不是 HTTPS,則應用程序可以正常通信。理想情況下,此應用程序將跨網絡運行。我已經嘗試將偵聽器應用程序託管在另一台服務器上,因此客戶端必須訪問網絡並將偵聽器加載到與客戶端相同的機器上。我正在嘗試消除任何編碼問題,以便將其交給我們的網絡人員,但我覺得他們需要指出一個方向。
Inner Exception: {"Unable to read來自傳輸連接的數據:
參考解法
方法 1:
Code wise, there is nothing wrong with what's shown in the OP. The problem is with using HTTPS without a signed certificate. After I created a self signed certificate and bound it to the port I was using (port 443), the application gladly accepted HTTPS requests.
The recommendations here will show how to correct the issue step by step:
https://stackoverflow.com/questions/11403333/httplistener‑with‑https‑support#=