Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SSRS DotNet版本和TLS1.2_C#_Reporting Services_Ssrs 2012 - Fatal编程技术网

C# SSRS DotNet版本和TLS1.2

C# SSRS DotNet版本和TLS1.2,c#,reporting-services,ssrs-2012,C#,Reporting Services,Ssrs 2012,我在SSRS 2012中使用自定义c#汇编。程序集使用TLS1.2调用另一个REST Web服务。我使用下面的命令在C#汇编中设置协议 在测试环境中,代码运行良好。但在prod env中,它失败了。在prod env中,我收到了这个错误“无法创建SSL/TLS安全通道。”经过分析,我发现唯一的区别是.net framework。在testenv中,我们有4.6,在prod中,我们有4.7。如何使该代码在4.7env中工作?下面是我试过的 由于SSRS 2012不支持4.x dotnet,因此c#

我在SSRS 2012中使用自定义c#汇编。程序集使用TLS1.2调用另一个REST Web服务。我使用下面的命令在C#汇编中设置协议

在测试环境中,代码运行良好。但在prod env中,它失败了。在prod env中,我收到了这个错误“无法创建SSL/TLS安全通道。”经过分析,我发现唯一的区别是.net framework。在testenv中,我们有4.6,在prod中,我们有4.7。如何使该代码在4.7env中工作?下面是我试过的

  • 由于SSRS 2012不支持4.x dotnet,因此c#汇编是在3.5框架中编写的
  • 我用3.5框架编写了另一个示例测试程序,当我在prod的同一个框中运行它时,它就工作了。因此,问题只在于SSR调用C#assembly时
  • 在我的测试应用程序的配置中,如果我添加这个,我会得到相同的错误“无法创建SSL/TLS安全通道。”。也就是说,当我强制应用程序使用4.0框架时,我得到了协议错误
  • 问题

  • SSR如何知道必须使用哪个版本的.net framework?它在哪里找
  • 将dotnet framework升级到4.7后,SSRS是否使用4.x作为框架
  • 如何解决上述问题?我的公司仅支持tls1.2
  • 谢谢

    ServicePointManager.Expect100Continue = true;
                ServicePointManager.DefaultConnectionLimit = 9999;
                var hr = (HttpWebRequest)WebRequest.Create(url);
                try
                {
                    ServicePointManager.SecurityProtocol = (SecurityProtocolType)( 0xc00);
                }
                catch (NotSupportedException)
                { //try TLS 1.2
                    
                    try
                    { //try TLS 1.2
                        Logger.Log("TLS 1.2");
                        ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072
                                                                | (SecurityProtocolType)768
                                                                | SecurityProtocolType.Tls;
                    }
                    catch (NotSupportedException)
                    {
                        try
                        {
                            Logger.Log("TLS 1.1");
                            ServicePointManager.SecurityProtocol = (SecurityProtocolType)768
                                                                    | SecurityProtocolType.Tls;
                        }
                        catch (NotSupportedException)
                        { //TLS 1.0
                            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
                        }
                    }
                    
                }