英文:
SQL Server: The certificate chain was issued by an authority that is not trusted
问题
ADDITIONAL INFORMATION:
与服务器成功建立了连接,但在登录过程中发生了错误。
(provider: SSL提供程序,错误:0 - 证书链
由不受信任的授权机构颁发。)
(Microsoft SQL Server,错误:-2146893019)错误编号:-2146893019
严重程度:20
状态:0程序位置:
在 Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,Boolean breakConnection,Action
1 wrapCloseInAction) 在 Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncClose) 在 Microsoft.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle,SNIPacket packet,UInt32& sniError,Boolean canAccumulate,Boolean callerHasConnectionLock) 在 Microsoft.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate) 在 Microsoft.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode,Boolean canAccumulate) 在 Microsoft.Data.SqlClient.TdsParser.TdsLogin(SqlLogin rec,FeatureExtension requestedFeatures,SessionData recoverySessionData,FederatedAuthenticationFeatureExtensionData fedAuthFeatureExtensionData,SqlClientOriginalNetworkAddressInfo originalNetworkAddressInfo) 在 Microsoft.Data.SqlClient.SqlInternalConnectionTds.Login(ServerInfo server,TimeoutTimer timeout,String newPassword,SecureString newSecurePassword) 在 Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo,String newPassword,SecureString newSecurePassword,Boolean ignoreSniOpenTimeout,TimeoutTimer timeout,Boolean withFailover,Boolean isFirstTransparentAttempt,Boolean disableTnir) 在 Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo,String newPassword,SecureString newSecurePassword,Boolean redirectedUserInstance,SqlConnectionString connectionOptions,SqlCredential credential,TimeoutTimer timeout) 在 Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout,SqlConnectionString connectionOptions,SqlCredential credential,String newPassword,SecureString newSecurePassword,Boolean redirectedUserInstance) 在 Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity,SqlConnectionString connectionOptions,SqlCredential credential,Object providerInfo,String newPassword,SecureString newSecurePassword,Boolean redirectedUserInstance,SqlConnectionString userConnectionOptions,SessionData reconnectSessionData,ServerCertificateValidationCallback serverCallback,ClientCertificateRetrievalCallback clientCallback,DbConnectionPool pool,String accessToken,SqlClientOriginalNetworkAddressInfo originalNetworkAddressInfo,Boolean applyTransientFaultHandling) 在 Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options,DbConnectionPoolKey poolKey,Object poolGroupProviderInfo,DbConnectionPool pool,DbConnection owningConnection,DbConnectionOptions userOptions) 在 Microsoft.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection,DbConnectionPoolGroup poolGroup,DbConnectionOptions userOptions) 在 Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,TaskCompletionSource
1 retry,DbConnectionOptions userOptions,DbConnectionInternal oldConnection,DbConnectionInternal& connection)
在 Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource1 retry,DbConnectionOptions userOptions) 在 Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource
1 retry,DbConnectionOptions userOptions)
在 Microsoft.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) 在 Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1 retry,SqlConnectionOverrides overrides)
在 Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
在 Microsoft.Data.SqlClient.SqlConnection.Open()
在 Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci,IServerType server)
在 Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
成功连接到SQL Server。
英文:
> ADDITIONAL INFORMATION:
>
> A connection was successfully established with the server,
but then an error occurred during the login process.
(provider: SSL Provider, error: 0 - The certificate chain
was issued by an authority that is not trusted.)
(Microsoft SQL Server, Error: -2146893019)
>
> Error Number: -2146893019
> Severity: 20
> State: 0
>
> Program Location:
>
> at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
> at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
> at Microsoft.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle, SNIPacket packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock)
> at Microsoft.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
at Microsoft.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
at Microsoft.Data.SqlClient.TdsParser.TdsLogin(SqlLogin rec, FeatureExtension requestedFeatures, SessionData recoverySessionData, FederatedAuthenticationFeatureExtensionData fedAuthFeatureExtensionData, SqlClientOriginalNetworkAddressInfo originalNetworkAddressInfo)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.Login(ServerInfo server, TimeoutTimer timeout, String newPassword, SecureString newSecurePassword)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover, Boolean isFirstTransparentAttempt, Boolean disableTnir)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, ServerCertificateValidationCallback serverCallback, ClientCertificateRetrievalCallback clientCallback, DbConnectionPool pool, String accessToken, SqlClientOriginalNetworkAddressInfo originalNetworkAddressInfo, Boolean applyTransientFaultHandling)
at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
at Microsoft.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry)
1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
Connect to SQL Server properly
答案1
得分: 5
对于 SQL Developer 2019:
- 打开 SQL Server Management Studio
- 选择您的实例
- 单击选项
- 转到连接属性
- 选择“信任服务器证书”
- 单击连接
英文:
For SQL Developer 2019
答案2
得分: 1
尝试将 "TrustServerCertificate=True;" 添加到您的连接字符串中。
英文:
Try adding TrustServerCertificate=True; to your connection string.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论