Hello I've recently added my existing .Net 5.0 Webapi to a docker container and it cannot connect to SqlServer on my local machine which the connection string is
"ConnectionStrings": {
"default": "Server=.\\SomeInstance;Database=TestDatabase;User Id=SomeUser;Password=SomePassword"
}
The exact error that I get is:
'One or more errors occurred. (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: TCP Provider, error: 25 - Connection string is not valid))'
When I change it to "Server=10.0.0.108\\SomeInstance;Database=TestDatabase;UserId=SomeUser;Password=SomePassword It works correctly.
How can I keep the connection string generic to work with multiple developers/machines and still use Docker.
I have tried using Server=localhost\\SomeInstance it does not work.