我在家中使用 IIS7.5 运行服务器,最近在其上运行了 SSL 测试 ( https://www.ssllabs.com/ssltest )。它返回建议更改我用来消除不推荐使用的密码套件的密码套件。我按照这里的说明操作:https://weakdh.org/sysadmin.html (向下滚动到 Microsoft IIS
)。我现在使用的密码套件来自这里:https://weakdh.org/sysadmin.html在 1.1 现代兼容性
下。显然,这是最严格的限制。
现在,当我尝试使用 SmptClient
发送电子邮件时,出现以下错误:
A call to SSPI failed, see inner exception.
内部异常:
The client and server cannot communicate, because they do not possess a common algorithm
我正在通过 smtp.gmail.com
发送电子邮件,我认为它支持现代密码套件(错误的假设?)。
最佳答案
您使用什么 .NET 版本? .NET 4.6 自动使用 TLS 1.2,但 .NET 4.5 等旧版本默认不使用 TLS 1.2。希望对您有所帮助。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // .NET 4.5
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; // .NET 4.0
关于c# - 更新 SSL 设置后无法通过 SMTP 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33790331/