My database and my web application are at the same server at the moment and I would like to access SQL Server as localhost
and close the SQL Server port for remote connections.
This is my current connection string, how can I modify it so it will access the database from as localhost
?
"ConnectionStrings": { "DefaultConnection": "Server=tcp:152.242.211.112;Initial Catalog=testdb;User ID=usera;Password=********" }
I tried:
server=(local) tcp=127.0.0.1 Data Source=(local)
using Data Source=(local)\SQLEXPRESS
I got this message:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 – No process is on the other end of the pipe.)
Advertisement
Answer
That’s what worked for me:
"DefaultConnection": "Data Source=(local);Initial Catalog=exampledb;Trusted_Connection=true;User ID=usera;Password=*******"