Share via


NegotiateStream 和 SslStream 允許連續的 Begin 作業

安全性串流的錯誤案例會以不同的方式處理,而連續呼叫 BeginAuthenticateAsServerBeginAuthenticateAsClient 不會再失敗。

導入的版本

5.0

變更描述

在舊版 .NET 中,未先呼叫 EndAuthenticateAsServerEndAuthenticateAsClient 即連續呼叫 BeginAuthenticateAsServerBeginAuthenticateAsClient,將會導致 NotSupportedException。 從 .NET 5 開始,連續呼叫 BeginAuthenticateAsServerBeginAuthenticateAsClient 不會再導致 NotSupportedException,因為這些 API 受到 Task 型實作的支援。

變更原因

將內部實作從非同步程式設計模型 (APM) 切換至 Task 型,可提升效能並降低程式碼複雜度。

開發人員無須採取任何動作。

受影響的 API