Umbraco-CMS: On startup if Umbraco cannot connect to the database, it always opens the installer
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
10.1.0
Bug summary
When Umbraco can’t connect to the database, the installer page opens even if the Umbraco environment was already configured.
Specifics
Using the Provider: Microsoft.Data.SqlClient
[11:27:08 DBG] Could not immediately connect to database, trying again.
[11:27:09 WRN] Configured database is reporting as not being available.
Microsoft.Data.SqlClient.SqlException (0x80131904): 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
---> System.ComponentModel.Win32Exception (53): The network path was not found.
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.Open()
at Umbraco.Extensions.DbConnectionExtensions.IsAvailable(IDbConnection connection)
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:53,State:0,Class:20
[11:27:09 DBG] Could not connect to database.
[11:27:09 DBG] Runtime level: Install - InstallMissingDatabase
I think this bug got introduced in this commit: https://github.com/umbraco/Umbraco-CMS/commit/8e6e262c7f0e3985014dd29cd635f2ac7a286b0f#diff-6ac9a3ad41721ad6c1743713a759eef7e43bd731f3ce6294023d2af3b7e7dd0eL146
Steps to reproduce
- Setup a Umbraco environment with SQL server that doesn’t run on your localdb.
- Now change the server part in the connectionstring to a domain that doesn’t exist for example: test.test
- Restart your Umbraco environment and the install page should show.
Expected result / actual result
Expected I expect to see a 500 page with the message: “A connection string is configured but Umbraco could not connect to the database.” like in Umbraco 9.
Actual Actual result is a installer page that everyone can see.
This item has been added to our backlog AB#22604
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 20 (19 by maintainers)
This should “fix” that problem for you… it will show you an error pge that the DB is out of reach, but it won’t prompt you to re-install.
For the team at HQ, I’ll summarize the problem here:
This is not correct, Umbraco does have a configured connection string and therefore should simply give the error that no connection can be made to the database.
We’ve added it to our backlog to look at in the next few weeks and will keep this issue updated.