【问题标题】:Ubuntu 22.04 + Jetbrains Rider cannot run integration testsUbuntu 22.04 + Jetbrains Rider 无法运行集成测试
【发布时间】:2022-06-17 02:16:13
【问题描述】:

您好,我是 ubuntu 的新用户(安装版本 22.04),我从一开始就遇到问题......目前我正在努力使用 Jetbrains Rider 运行集成测试(我运行应用程序没有任何问题并连接到这个数据库)。

我的错误是:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)

System.Security.Authentication.AuthenticationException
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
at System.Net.Security.SslStream.ProcessAuthentication(Boolean isAsync, Boolean isApm, CancellationToken cancellationToken)
at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)
at System.Data.SqlClient.SNI.SNITCPHandle.EnableSsl(UInt32 options)

System.TypeInitializationException
The type initializer for 'SslMethods' threw an exception.
at Interop.OpenSsl.AllocateSslContext(SslProtocols protocols, SafeX509Handle certHandle, SafeEvpPKeyHandle certKeyHandle, EncryptionPolicy policy, SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SafeDeleteSslContext..ctor(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials credential, SafeDeleteSslContext& context, ReadOnlySpan`1 inputBuffer, Byte[]& outputBuffer, SslAuthenticationOptions sslAuthenticationOptions)

System.TypeInitializationException
The type initializer for 'Ssl' threw an exception.
at Interop.Ssl.SslV2_3Method()
at Interop.Ssl.SslMethods..cctor()

System.TypeInitializationException
The type initializer for 'SslInitializer' threw an exception.
at Interop.Ssl..cctor()

Interop+Crypto+OpenSslCryptographicException
error:0E076071:configuration file routines:MODULE_RUN:unknown module name
at Interop.SslInitializer..cctor()

Ubuntu 22.04、.dotnet 5.0.213、Rider 2022.1

有人遇到过这样的问题吗?

【问题讨论】:

  • 看起来是证书问题,可能您不信任服务器的证书
  • 也许吧,但它很奇怪,因为我可以通过应用程序或 Rider 数据库浏览器连接,所以为什么我不能通过测试?

标签: .net xunit.net rider


【解决方案1】:

这可能是由于 OpenSSL 配置。我有一个类似的问题并用这个命令解决了它:

sed -i 's/openssl_conf = openssl_init/#openssl_conf = openssl_init/g' /etc/ssl/openssl.cnf 

Commit on githubGithub issue

了解更多详情。

【讨论】:

  • 哇,就是这样!完全有帮助,非常感谢!这是我第一次使用 ubuntu,所以我无法自己弄清楚:D
【解决方案2】:

您可以尝试在连接字符串中添加:Encrypt=False;TrustServerCertificate=True"。当然,这只是一个临时解决方案,只能用于测试。

【讨论】:

  • 我尝试在连接字符串中使用它,但遗憾的是,它没有帮助:(
猜你喜欢
  • 1970-01-01
  • 2020-04-12
  • 1970-01-01
  • 1970-01-01
  • 2022-11-11
  • 1970-01-01
  • 2023-02-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多