question

LaurenceMee-3146 avatar image
14 Votes"
LaurenceMee-3146 asked EvandroBoaSemedo-7272 answered

Error when connecting to Azure SQL Database from Client

This has just started happening, it was fine up until about an hour ago. Nothing was changed. Then suddenly I started getting the following error from SSMS:

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

Cannot connect to *.database.windows.net.

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

A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.) (.Net SqlClient Data Provider)


For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=10054&LinkId=20476


Server Name: *.database.windows.net
Error Number: 10054
Severity: 20
State: 0



Program Location:

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
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 oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
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.UI.ConnectionDlg.Connector.ConnectionThreadUser()

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

An existing connection was forcibly closed by the remote host

azure-sql-database
· 50
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

For me it just started working again.


2 Votes 2 ·

Started running again on the old apps without any modification at 11:25 local time (DK)
Haven't seen any official statement on the outage yet ?

0 Votes 0 ·

We have the same problem for West Europe SQL database.


There is a similar question asked on StackOverflow. I have tested the answer there but it doesn't seem to make any difference:
https://stackoverflow.com/questions/62226331/08s01-odbc-driver-17-for-sql-server-tcp-provider-error-code-0x2746-10054


Nothing has changed on our side of the application, so my guess for now is some kind of issue or change on the Azure side.


1 Vote 1 ·

Hmmmm, changing default settings to no connectivity over night - that's a really bad choice...

Following the stackoverflow answer, made me able to access my databases again (y)

2 Votes 2 ·

Oh, have to add that I added a sql restart by temporarily reconfigure the database to another level and back again.

1 Vote 1 ·
Show more comments

This is on all Azure SQL Databases I've got on several subscriptions, and the Client IP being allowed through the firewall is still correct.

0 Votes 0 ·

Hi,

Are you using azure database serverless?

0 Votes 0 ·

No, they all have a SQL Server instance.

0 Votes 0 ·

I'm in the UK connecting to Azure SQL Databases (on SQL Servers) in West Europe.

0 Votes 0 ·

Seems like issue in "West Europe". I also have issue with West Europe. I am waiting to see if other regions are reported as well.

0 Votes 0 ·

It seems that the databases can be connected to by Azure Apps, just not external clients through the firewall.

0 Votes 0 ·

True.
Just ran the "Azure SQL Connectivity Checker v1.4" ps script and all is fine until it reads:

 Testing connecting to master database:
  Error:  10054 State: 0 : A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)


Zone: West Europe

0 Votes 0 ·
Show more comments

I am having the same problem ( on 3 different Azure SQL Database ). In the last 30 minutes.


I get the same error locally; but Azure Web app connection is working.


0 Votes 0 ·

Looks like an Azure issue. Lets hope someone reports it and it gets fixed soon.

0 Votes 0 ·
Show more comments
pituach avatar image
2 Votes"
pituach answered pituach edited

Good day all,

I confirmed that there is probably an issue with the service at this time.

I cannot connect to two of the Azure SQL logical Servers as well - both servers are in "West Europe"

Please edit all your reports and add the information regarding which region are you using

Update: Confirmed that in "East US" the service is OK.

Update 06:47 IDT: I can connect from time to time. I try multiple times and sometime it works and someone not.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

mappie-kochi avatar image
0 Votes"
mappie-kochi answered

Are you investigating the meaning of the error code "Error Number: 10054 Severity: 20 State: 0"?
What about checking your Service Principal Name (SPN)?

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d87a4752-8ab9-4870-88e2-7b3b23805c00/microsoft-sql-server-error-10054-an-existing-connection-was-forcibly-closed-sql-server-2012?forum=sqldataaccess

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sirlupinwatson avatar image
0 Votes"
Sirlupinwatson answered pituach commented

Did you try the Hot Fix proposed here ?


· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I don't think that is relevant.

0 Votes 0 ·

If not relevant, something else is pointing at Error code 10054 supplied in your log and is leading to this returning number.

0 Votes 0 ·

The issue was fixed about 4 hours ago and officially reported. I also reported update on my post till it was fixed. There is a full information from Microsoft on the issue and on the procedure to fix it as well

0 Votes 0 ·
LaurenceMee-3146 avatar image
1 Vote"
LaurenceMee-3146 answered

The issue appears to have been resolved in that for the last 4 hours I have been able to connect to the SQL Database from a client external to Azure. I will continue to monitor this.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

NavtejSaini-MSFT avatar image
0 Votes"
NavtejSaini-MSFT answered NavtejSaini-MSFT edited

@pituach - Thanks for responding on this and answering on other thread and your blog

Thanks to @LaurenceMee-3146 and others who provided the confirmation for the resolution.,

Everyone - As confirmed in above threads the issue is resolved. Also i have converted the answers to comments as applicable.

If someone is still facing this issue, please get back to us on this thread and we will look into this further.

Thanks
Navtej S


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AshleyTuring-5581 avatar image
0 Votes"
AshleyTuring-5581 answered

We are still receiving this error the database is West Europe can you please advise?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

bjn avatar image
0 Votes"
bjn answered bjn edited

have you tried switching to the microsoft.data client (if applicable) and use the retry/timeout parameter?
https://github.com/dotnet/SqlClient/blob/master/release-notes/2.0/2.0.0.md#new-connection-string-property-synonyms

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KumariShivamRBEIPJHoTBE1-6639 avatar image
0 Votes"
KumariShivamRBEIPJHoTBE1-6639 answered KalyanChanumolu-MSFT commented

Hi Team,

I am trying to connect to Azure SQL database by .net core API and getting below mentioned error . Same while connecting with SSMS 2018 as well

System.Data.SqlClient.SqlException
HResult=0x80131904
Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No such host is known.)
Source=Core .Net SqlClient Data Provider
StackTrace:
at System.Data.ProviderBase.DbConnectionPool.CheckPoolBlockingPeriod(Exception e)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
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 RADARTool.Controllers.ProjectDetailsController.Get() in C:\Users\UHM3KOR\Desktop\RadarFiles\RADARTool\RADARTool\Controllers\ProjectDetailsController.cs:line 24
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

Inner Exception 1:
Win32Exception: No such host is known.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KumariShivamRBEIPJHoTBE1-6639 Are you still facing this issue?
Please create a new question and post the code sample for us to investigate.

0 Votes 0 ·
EvandroBoaSemedo-7272 avatar image
0 Votes"
EvandroBoaSemedo-7272 answered
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.