Visual Studio无法发布Web应用程序

时间:2017-06-27 07:25:44

标签: c# asp.net curl visual-studio-2015

我的ASP.NET Web项目将使用WebRequest调用cURL 我曾经打电话给PayPal的cURL来获取访问令牌,因此我使用了以下代码:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;

我可以构建项目并以调试模式运行。但是,当我单击“发布”时,Visual Studio将返回以下错误。

  

'System.Net.SecurityProtocolType'不包含'Tls11'的定义

我尝试使用Visual Studio 2015& 2017年发布网络,但仍无效。

Able to run in debug mode

有关背景信息:我的项目正在运行.NET Framework 4.5,Windows 10

1 个答案:

答案 0 :(得分:2)

这是.NET framework 4.5的一个已知问题,并且有一个开放的bug。问题是编译器不包含int的{​​{1}}枚举。

将此作为解决方法使用:

Tls11