CentOS上的VSTS-Agent安装返回错误' System.Security.Cryptography.Native.OpenSsl' :(来自HRESULT的异常:0x8007007E)

时间:2018-05-12 16:10:26

标签: tfs azure-devops centos7

我正在尝试在CentOS操作系统上安装VSTS代理,并且在尝试运行./config.sh时,我在$ {myagent_dir} / _ diag目录中看到以下错误

> [2018-05-12 15:44:09Z ERR  Terminal]
> System.TypeInitializationException: The type initializer for
> 'System.Net.Http.CurlHandler' threw an exception. --->
> System.TypeInitializationException: The type initializer for 'Http'
> threw an exception. ---> System.TypeInitializationException: The type
> initializer for 'HttpInitializer' threw an exception. --->
> System.TypeInitializationException: The type initializer for
> 'CryptoInitializer' threw an exception. --->
> System.DllNotFoundException: Unable to load DLL
> 'System.Security.Cryptography.Native.OpenSsl': The specified module
> could not be found.  (Exception from HRESULT: 0x8007007E)    at
> Interop.CryptoInitializer.EnsureOpenSslInitialized()    at
> Interop.CryptoInitializer..cctor()    --- End of inner exception stack
> trace ---    at Interop.CryptoInitializer.Initialize()    at
> Interop.HttpInitializer..cctor()    --- End of inner exception stack
> trace ---    at Interop.HttpInitializer.Initialize()    at
> Interop.Http..cctor()    --- End of inner exception stack trace ---   
> at Interop.Http.GetSupportedFeatures()    at
> System.Net.Http.CurlHandler..cctor()    --- End of inner exception
> stack trace ---    at System.Net.Http.CurlHandler..ctor()    at
> Microsoft.VisualStudio.Services.Agent.Util.ApiUtil.CreateConnection(Uri
> serverUri, VssCredentials credentials, IEnumerable`1
> additionalDelegatingHandler)    at
> Microsoft.VisualStudio.Services.Agent.Listener.Configuration.BuildReleasesAgentConfigProvider.<TestConnectionAsync>d__14.MoveNext()

我的设置如下

[user@server ~]# cat /etc/*release*
CentOS Linux release 7.5.1804 (Core)
Derived from Red Hat Enterprise Linux 7.5 (Source)

此外,我必须通过以下链接安装不同版本的libicu以解决&#34;无法初始化CoreCLR,HRESULT:0x80131500&#34;问题。

http://fsoikin.blogspot.com/2015/12/getting-coreclr-running-on-centos.html

我确保通过以下链接获得了所有先决条件,并且在执行所有yum安装时没有任何问题

https://github.com/Microsoft/vsts-agent/blob/master/docs/start/envredhat.md https://www.microsoft.com/net/learn/get-started/linux/centos

我正在执行以下步骤

[user@server ~]$ export LD_LIBRARY_PATH=/opt/libicu52:/usr/lib64/:/usr/lib
[user@server ~]$ cd /opt/tfs_agent/
[user@server tfs_agent]$ ./config.sh

>> End User License Agreements:

Building sources from a TFVC repository requires accepting the Team Explorer Everywhere End User License Agreement. This step is not required for building sources from Git repositories.

A copy of the Team Explorer Everywhere license agreement can be found at:
  /opt/tfs_agent/externals/tee/license.html

Enter (Y/N) Accept the Team Explorer Everywhere license agreement now? (press enter for N) > Y

>> Connect:

Enter server URL > https://tfs_url/collectionName/_admin/_AgentPool
Enter authentication type (press enter for Negotiate) > PAT
Enter personal access token > ****************************************************
Connecting to server ...
The type initializer for 'System.Net.Http.CurlHandler' threw an exception.
Failed to connect.  Try again or ctrl-c to quit
Enter server URL > Exiting...

在尝试使用MacOS执行相同操作时,在线搜索结果指向Openssl问题,但似乎没有一个适用于我的情况。对此有任何帮助表示赞赏!

2 个答案:

答案 0 :(得分:1)

以下链接的先决条件:Red Hat/CentOS System Prerequisites [2.124.0 or below]

它仅适用于2.124.0或更低版本的构建代理版本。

最新的构建代理版本为v2.133.3请仔细检查您的构建代理版本,如果您使用的是2.125.0或更高版本,则需要确保您的机器符合以下先决条件:

<强> Linux System Prerequisites [2.125.0 or above]

此外,建议您也阅读本官方教程如何Deploy an agent on Linux

答案 1 :(得分:0)

问题是我下载了一个不正确的版本(为Ubuntu构建)。通过下载正确版本的代理程序可以解决该问题。