我有一个使用目标框架 4.6.1 构建的 C# dll,我在 Excel 插件和可执行文件中使用它(也使用目标框架 4.6.1 构建)。
我没有在我的 dll 中指定 ServicePointManager.SecurityProtocol,因此它可以根据 Microsoft 的建议使用操作系统支持的最高版本。
但是当我通过 Excel 加载项运行 dll 时检查 ServicePointManager.SecurityProtocol 时,它被设置为Ssl3|Tls
当我在 exe 中运行相同的 dll 时,ServicePointManager.SecurityProtocol 是Tls|Tls11|Tls12|Tls13
我在同一台机器上看到了这种行为。
我知道对安全协议的支持因框架的版本而异。
希望能帮助您理解行为。我试图避免在我的 DLL 中对 Tls 版本进行硬编码。
谢谢