Reputation: 39268
I've switched from AzureDb to a local SQL Server Express instance for my project. I can connect to the instance using Management Studio and see that the server is the usual .\sqlserver
with sa
and a dummy password. The actual database isn't created yet but I can access the server and see system databases as well as create logins.
However, trying to perform a migration database update, I get the following 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: SNI_PN11, error: 26 - Error Locating Server/Instance Specified)
Naturally, I suspected something with my connection string (which I still do).
"ConnectionStrings": { ...
"SqlServer": "Server=.\\sqlserver;Database=Blopp;Uid=sa;Pwd=Abc123();"
}
I've tried all the usual variations - single backslash, quadrupple backslash, forwardslash, at-char in the beginning, (localhost) instead of dot, computer name instead of dot etc. I'm out of ideas what else it might be. I've tried creating the DB manually. I tried using caps (although I know it's case insensitive). Nothing helped...
Proof of the usual effort: here (SO), here (MSDN), here (SO), here (SO), here (Hanselman), here (client protocol/service running).
What on earth am I missing?
Upvotes: 0
Views: 1503
Reputation: 484
Base on the error, you have either a Network or a SQL configuration problem.
To further confirm this, you can do a UDL test (or the most basic non SSMS test you can do), Ref: How to perform a UDL test to check the SQL Server Connectivity.
The first answer to Why am I getting “Cannot Connect to Server - A network-related or instance-specific error”? has a good troubleshooting checklist for the kind of error you mention.
If your UDL test works, but you still cannot connect. Check your connection string. An easy way to do so is: Go to Visual Studio (Visual Studio not SQL Server Management Studio) and do:
Taken from: Juned Khan Momin answer to this question: How to get the connection string from a database
Upvotes: 1