I have SQL Server on the server. It has a username/password and a mixed auth. If I open port 1433 on the server and connect to the database via IP:Port, site works as it should.
A string in appsettings.json
looks like this:
"ConnectionStrings": {
"DefaultConnection": "Data Source=IP,Port; User ID='sa'; Password='password'; Database=DBName;"
}
But I want to turn off external database connection.
I need to write it in appsettings.json
connectiong to the database as localhost.
Maybe I need some kind of permissions somewhere else?
How do I do this?
This line works on the home computer for the project in localhost.
But it does not work on the server.
"DefaultConnection": "Data Source=(localdb)\mssqllocaldb;Database=DBName;Trusted_Connection=True;MultipleActiveResultSets=true;"
I’ve tried different variants. Either it doesn’t work or it works, but somehow partially with errors.
I see such error in log:
2024-07-28T09:24:50.2366385+03:00 INFO [Project.Utility.NotFoundMiddleware] [0] Handling 404 error for request /Home/Error
I see such errors in browser:
404 or 500
1