Hi, I am creating an Asp net core 2.2 application for witch I need to update my database frequently. I used to do this with Migrations (add-Migration and update-Database ). But lately I get an error message when I try to use the Update-Database migration command, saying: 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)
My guess is that this has to do with the fact that I added a singleton Database reference in my Startup.cs file (see microsoft forum: https://forums.asp.net/t/2165973.aspx?Dependency+injection+in+HostedService+failing.
The database reference did not change and the 'normal' database access is still working without problems. I can workaround this problem by using an backup from before this implementation, and apply the migration on this backup. but things are getting rather messy this way.
My question : is this a known problem with migrations? if so what is the solution to fix it? if not a known problem, can somebody tell me where the update-database migration command gets its database reference from?