I have installed SQL server on my ubuntu ( 17.04 ) and it is running perfectly fine. I am using the Jetbrains Rider for my C# development work and I can connect to my local SQL Server instance via the Database tool comes with Jetbrains Rider.
But when I'am trying to connect to the same DB from my App it is raising 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: TCP Provider, error: 25 - Connection string is not valid) ---> System.Net.Sockets.SocketException (0x80004005): Success
Following is my connection string in my appsettings.json file
"ConnectionStrings": {
"DefaultConnection": "Data Source=localhost\\sqlexpress:1433;Database=MyDb;User Id=SA;Password=MyPasswd;"
},
I tried to connect with out the port number and "Initial Catalog" instead of "Database" in connection string as well.
How can I set up my connection string properly?