SecurityProtocolTypeExtensions.Tls12;在当前上下文中不存在 [英] SecurityProtocolTypeExtensions.Tls12; does not exist in current context
问题描述
我正在将安全协议更新到我现有的3.5 .net框架应用程序中,以使付款网关运行顺畅。我添加了以下代码
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolTypeExtensions.Tls12;
在我的 Global.asax
中c $ c> Application_Start ,但它给我带来了编译时错误
名称'SecurityProtocolTypeExtensions'不存在存在于
当前上下文中
我正在关注此链接S 支持。 更新1: 也尝试了上述链接中所述的方法,将两个文件都添加到了项目中,现在我出现异常 已更新2: 三由乔恩·戴维斯(Jon Davies)建议,但仍然没有运气。相同的异常 此文章中介绍了此修复程序您已链接到: 要包括对TLS v1.2的支持,请在项目中包括源文件... 换句话说-您需要添加 这有点难看,但是因为TLS 1.2已发布 .NET 3.5之后。 或者,如果您想避免使用这些扩展名并且不介意代码中未标记的魔术数字,则可以忽略该代码在文章中,而是对其进行设置: I am updating Security protocols to my existing 3.5 .net framework application to work my payment gateways smooth. I have added following code in my The name 'SecurityProtocolTypeExtensions' does not exist in the
current context I was following this link Support for TLS System Default Versions included in the .NET Framework 3.5.1 on Windows 7 SP1 and Server 2008 R2 SP1 provided by Microsoft. Update 1: Also tried as told in above link, added both files in project, now I am getting an exception " Updated 2: Tried as suggested by Jon Davies, but still no luck. same Exception The fix is stated in the article you linked to: To include the support for TLS v1.2, include the source files in your project... In other words - you need to add the It's a bit of an ugly hack, but is required because TLS 1.2 was released after .NET 3.5. Alternatively if you want to avoid using these extensions and don't mind unlabelled magic numbers in your code, you could ignore the code in the article and just set this instead:
这篇关于SecurityProtocolTypeExtensions.Tls12;在当前上下文中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
System.NotSupportedException
:不支持所请求的安全协议
System.NotSupportedException
SecurityProtocolTypeExtensions
和 SslProtocolExtensions
从文章到您自己的项目。
System.Net.ServicePointManager.SecurityProtocol =(SecurityProtocolType)0x00000C00;
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolTypeExtensions.Tls12;
Global.asax
in Application_Start
but it is giving me compile time error that
System.NotSupportedException
: The requested security protocol is not supported"System.NotSupportedException
SecurityProtocolTypeExtensions
and SslProtocolExtensions
types from the article to your own project.System.Net.ServicePointManager.SecurityProtocol = (SecurityProtocolType)0x00000C00;