I get this error when i run Update-database command on VS 2017 package manger console .
I have Windows server 2016 and install SQL 2016 on that , open all necessary port as 1433 on fire wall, also add sql server.exe to enable from firewall. Ok, In VS 2017 Server explorer Panel I can connect to the server and I can see my database and tables .
after create my Models in code first mode >
. I run add-migration in my package console and this work fine . run update-database I got this error
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)
Why I have this error only when run update-database and don't have on server explorer panel ?
In additional i check TCP-Ip in SQl server configuration also enabled sql server browser .
Update:
My Connection String is
var connection = @"Server=***.***.***.***;Database=Mydatabase;Integrated Security=false;Initial Catalog=Mydatabase;User ID=MyDbYser;Password=MyDbPassword;";
services.AddDbContext<UniverContext>(options =>
options.UseSqlServer(connection));