Provider ssl provider error 0 время ожидания операции истекло

Неожиданно перестала подключаться Management studio к серверу.
  • Remove From My Forums
  • Вопрос

  • Неожиданно перестала подключаться Management studio к серверу.

    Сообщение об ошибке:

    Не удается подключиться к tst-db-2k5-01.

    ===================================

    Подключение к серверу успешно установлено, но затем произошла ошибка в процессе подтверждения, предшествующего входу. (provider: SSL Provider, error: 0 — Время ожидания операции истекло.) (.Net SqlClient Data Provider)

    ——————————
    Чтобы получить справку, щелкните: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=258&LinkId=20476

    ——————————
    Имя сервера: tst-db-2k5-01
    Номер ошибки: 258
    Серьезность: 20
    Состояние: 0

    ——————————
    Расположение программы:

       в System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       в System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       в System.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean& marsCapable)
       в System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
       в System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
       в System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer
    timeout)
       в System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
       в System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance,
    SqlConnectionString userConnectionOptions)
       в System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
       в System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
       в System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
       в System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       в System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
       в System.Data.SqlClient.SqlConnection.Open()
       в Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
       в Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()

    ===================================

    Время ожидания операции истекло

    Тип аутентификации: проверка подлинности Windows.

    Переустановка SQL Server management studio 2012 не помогает.

    Как можно восстановить нормальную работу?

    • Изменено

      21 ноября 2013 г. 7:52

Ответы

  • На ПК обнаружен троян, который влиял на сетевые соединения. После его удаления всё заработало.

    • Помечено в качестве ответа
      Vladislav Boyarkin Alico
      29 ноября 2013 г. 10:03

I did not have this problem until last week. Now whenever I try to connect to a remote database from mu laptop I get this error.

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 — The wait operation timed out.) (.Net SqlClient Data Provider)

Program Location:

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean& marsCapable)
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer
timeout)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance,
SqlConnectionString userConnectionOptions)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
   at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ConnectToServer(UIConnectionInfo connectionInfo, IDbConnection liveConnection, Boolean validateConnection)

===================================

The wait operation timed out

I am using Management Studio 2014.

I did not have this problem until last week. Now whenever I try to connect to a remote database from mu laptop I get this error.

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 — The wait operation timed out.) (.Net SqlClient Data Provider)

Program Location:

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean& marsCapable)
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer
timeout)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance,
SqlConnectionString userConnectionOptions)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
   at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ConnectToServer(UIConnectionInfo connectionInfo, IDbConnection liveConnection, Boolean validateConnection)

===================================

The wait operation timed out

I am using Management Studio 2014.

Problem

System was initially working OK (no problems/errors).

Customer then modifies the Microsoft networking TLS settings (on both the Controller application server and SQL database server) so that:

  • TLS 1.0 disabled
  • TLS 1.1 disabled
  • TLS 1.2 enabled

After making those changes, user launches Controller client. User then:

  • Chooses database
  • Types in username/password

An error appears.

Symptom

image-20190710091406-1

System.Web.Services.Protocols.SoapException: Server was unable to process request. —> System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 — An existing connection was forcibly closed by the remote host.) —> System.ComponentModel.Win32Exception: An existing connection was forcibly closed by the remote host
   — End of inner exception stack trace —
   at Cognos.Controller.Proxy.ControllerReportNetService.RepNet.GetUserInfo(String sGuid, String sUser, String passportId)
   at Cognos.Controller.Proxy.CCRWS.GetUserInfo(String sGuid, String sUser, String passportId)
   — End of inner exception stack trace —
   at Cognos.Controller.Forms.Common.Main.DoLoginCognos8(Form& frm)
   at CCR.AppContext.DoLogin()
   at CCR.AppContext.Login()

Cause

The Controller application server cannot connect to the Microsoft SQL database server.

Example

In one real-life customer scenario, the cause was Microsoft patch KB4467697  (on the Controller application server).

Resolving The Problem

Fix:

Uninstall the Microsoft patch KB4467697 from the Controller application server:

image-20190710114848-1

Workaround:

Re-enable the TLS 1.0/1.1 protocols (on both the Controller application server and SQL database server).

Related Information

Document Location

Worldwide

[{«Business Unit»:{«code»:»BU059″,»label»:»IBM Software w/o TPS»},»Product»:{«code»:»SS9S6B»,»label»:»IBM Cognos Controller»},»Component»:»»,»Platform»:[{«code»:»PF033″,»label»:»Windows»}],»Version»:»All Versions»,»Edition»:»»,»Line of Business»:{«code»:»LOB10″,»label»:»Data and AI»}}]

Полностью ошибка звучит как «Подключение к серверу успешно установлено, но затем произошла ошибка при входе (provider: SSL Provider, error:0 — Предоставлен неправильный дескриптор)»

Для подключения используем строку Data Source=tcp:x.x.x.x.;Initial Catalog=bd_name;Persist Security Info=True;User Id=saturn;Password=password;MultipleActiveResultSets=True

Это ошибку вызывают как наша программа, так и встроенный обозреватель (Database Manager) в IIS 8.
Но, что удивительно — SQL Manager for SQL Server (portable, lite edition) подключается нормально.

Очень прошу: подскажите, в какую сторону копать?

ПО: IIS 8, Windows Server 2012, MS SQL 2012 Standart.


  • Вопрос задан

    более трёх лет назад

  • 5650 просмотров

1. HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServerClientSuperSocketNetLib должна быть, вот параметра Force Protocol Encryption там может и не быть (это нормально). на стороне сервера sql
2. HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL ServerMSSQL11.MSSQLSERVERMSSQLServerSuperSocketNetLib
«ForceEncryption»=dword:00000000
«HideInstance»=dword:00000000
«Certificate»=»»
«ExtendedProtection»=dword:00000000
«MSSQL11.MSSQLSERVER» — имя вашего экземпляра sql.
параметры такие стоят?

3. на сервере iis — панель управления — администрирование — источники данных ODBC попробуйте добавить вашу базу в пользовательский DSN, проходит?

Пригласить эксперта

1. HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServerClientSuperSocketNetLibEncryptForce Protocol Encryption какое значение стоит? Если 1, то изменить на 0 и перезагрузить сервер, помогло? Если да, то остальные вопросы не важны.
2. сервер и клиент на разных компьютерах?
3. криптографическое по на компьютерах используется? если да, то где, клиентский компьютер, сервер sql?

1. Это смотреть на стороне сервера mssql или на стороне iis? (ветки мы эти не нашли).
2. На разных бд и iis на разных серваках стоят.
3. нет такое по нет.

Мне больше всего интересно почему SQL Manager for SQL Server подключается.

моя строка подключения выглядит так :
«Data Source=DESKTOP-Qasd11O\Sasd01;Database=Kourse;User ID=user;Password=123;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False»,
помогло исправление TrustServerCertificate=false на true


  • Показать ещё
    Загружается…

10 февр. 2023, в 02:20

3000 руб./за проект

10 февр. 2023, в 01:33

1500 руб./за проект

10 февр. 2023, в 00:54

2000 руб./в час

Минуточку внимания

Join the DZone community and get the full member experience.

Join For Free

SSL certificates are very important for authenticating websites and ensuring connections are encrypted. However, there are some scenarios when they can create headaches. Rather than throw the baby out with the bathwater and abandon the use of SSL, you should know how to use them properly.

One issue that you can run into will occur when connecting with a remote computer. You might try to connect to an SQL Server from a remote computer with the same credentials that you used to connect locally. Unfortunately, you might receive an error like this.

“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.) (.Net SqlClient Data Provider).”

There is no way to connect to the server when this error message occurs. The message discusses a certificate and references the SSL provider of the SQL Server. However, you have not installed a certificate on the server, so you won’t be able to identify the underlying issue.

You need to know how to resolve these issues. You also need to make sure that they work with different content settings, such as PowerPoint templates created with a tool like SlideUplift. I mentioned this in my previous article Relationship Between SSL Certificate Key Length and SQL Performance, which established the importance of optimizing SSL when testing PowerPoint presentations and other content settings.

The server will install a self-signed certificate for it, unless you specify that you would like another one to be setup. This certificate is created by the SQL Server. It won’t be supported by a real public key infrastructure. This means that the certificate can encrypt communications and validate their integrity. Unfortunately, it does not verify that you are connecting to the right server, since the only ‘authority’ that assures us that the server is the correct one is the server itself.

That is precisely what this error message is about. What it tells us is that, by default, as the identity of the server cannot be verified, it does not allow the connection.

Something similar happens with many other services that use an SSL certificate by default. For example, when connecting for the first time to a remote computer using a Terminal Server (also called Remote Desktop), you will be asked whether or not you want to trust the certificate and therefore connect to the server.

This makes sense since there are three main purposes of a digital certificate:

  • Privacy of the information, which includes encrypting communications in transit.
  • The integrity of the communication, which combines them with digital summaries.
  • Trust, which is ensured by verifying that communications come from whom they say they come from and that they are not communicating with their intended servers.

The first two purposes can’t be supported if trust is not adequately established.

How Do You Solve This Problem?

If the error is issued by the SQL Server Management Studio when you try to connect from the login screen, then you have to go to the advanced options of that dialog. After reaching this section, you will need to go to the tab named ‘Connection Properties’ and make sure that the ‘Encrypt connection’ option is checked.

You can always uncheck it and prevent the error from occurring, but then the traffic between your computer and the remote SQL Server will no longer be secured, which entirely defeats the purpose of SSL encryptions.

The next step is to go to the ‘Additional Connection Parameters’ tab. You must then write a switch to make the connection trust the remote SQL Server certificate. This additional parameter is:

TrustServerCertificate=True.

Just type it in the text box in that window. After clicking on ‘Connect,’ you will notice that the error disappears and will be able to work normally.

If the error is being given by an application, we only have to modify the connection string and put the same parameter at the end.

If you do this, then you have to be sure that the server we are connecting to is the one we are interested in and that no security problem could be falsifying the DNS so that you connect to another site.

Connection string
sql

Opinions expressed by DZone contributors are their own.

Posted by blakhani on November 14, 2014

I said earlier that I have bunch of *good* friends who remember me whenever they get any issue with SQL Server. So I got a call from my friend and he told that he is not able to connect to SQL Server from some client. Since it’s only few client, we can easily rule out the issue with SQL Engine not allowing connection. I asked him to connect via SQL Server Management Studio and got below error.

TITLE: Connect to Server
——————————
Cannot connect to SQLDBServer.
——————————
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 – The token supplied to the function is invalid) (Microsoft SQL Server, Error: -2146893048)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-2146893048&LinkId=20476
——————————
BUTTONS:
OK
——————————

Did basic troubleshooting as below

  • Tested basic connectivity like ping, telnet etc. everything is working fine, except the connection to SQL engine from this machine.
  • Error message says SSL but there was no certificate used in SQL Server.
  • There was no certificate used.

Next major task is to find out what is the difference in both servers. So I asked him what were the things done on “bad” client. He said that he applied bunch on Windows updates. Looking at list I found one which talks about SSL.

http://support.microsoft.com/kb/2643584 (MS12-006: Vulnerability in SSL/TLS could allow information disclosure: January 10, 2012)

We check the machines and found that SendExtraRecord was 1 on “bad” client whereas other “good” clients it was 2.

Here were the steps taken to solve the issue. (taken from KB)

  1. Click Start, click Run, type regedit in the Open box, and then click OK.
  2. Locate and then click the following subkey in the registry:

    HKEY_LOCAL_MACHINESystemCurrentControlSetControlSecurityProvidersSCHANNEL

  3. On the Edit menu, point to New, and then click DWORD Value.
  4. Type SendExtraRecord for the name of the DWORD value, and then press Enter. 
  5. Right-click SendExtraRecord, and then click Modify.
  6. In the Value data box, type 2 to disable the split record in schannel, and then click OK.
  7. Exit Registry Editor.

In our case it was 1 and making it 2 fixed the issue and were were able to covert bad clients to good clients.

Hope this helps.

Cheers,
Balmukund

This entry was posted on November 14, 2014 at 3:30 AM and is filed under Connectivity, Error.
Tagged: pre-login handshake, SQL, SSL Provider, The token supplied to the function is invalid. You can follow any responses to this entry through the RSS 2.0 feed.

You can leave a response, or trackback from your own site.

Понравилась статья? Поделить с друзьями:
  • Provider sql network interfaces error 26 ошибка при обнаружении указанного сервера или экземпляра
  • Provider sql network interfaces error 26 error locating server instance specified
  • Provider sql network interfaces error 25 недопустимая строка подключения
  • Provider sql network interfaces error 25 connection string is not valid
  • Provider session provider error 19