update-database: “A network-related or instance-specific error occurred while establishing a connection to SQL Server”

I finally found out. I have a website project and my API in my solution. The problem was that the website was set as startup project. So that entity framework searched the connection string in the website’s web.config and not in the api’s web.config. Changing the startup project to my API solved the problem.

If you want to have the website project as startup project. Just copy the connection string into the websides web.config.

Nevertheless thanks for everyones help.

Leave a Comment