❔ EF successfully updated database, but unable to connect to sql server when getting data.
Hey guys, getting back into .net after a while. sql server is currently on docker and I am able to connect to the db when running my migration. However, trying to get data through the same context used when running the migration I am unable to connect to the sql server. Any tips? Currently loosely following a tutorial which doesn't use docker for his DB. Using .net 7
Full connection string: "Server=localhost;Database=superherodb;User=SA;Password=M1P4ssw0rd!@#;TrustServerCertificate=true;integrated security=false"
4 Replies
If you're sending the request to a running docker container, are you sure the docker image is up to date?
Also, can one docker container reach the other? I think in the connection string you need to put
Server=superherodatabase
You can override the connection string in your docker-compose environment variables using:
(note two underscores)Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
you're right! I was completely forgetting that running the migration is calling from local to the sql server container whereas the application is from a docker container to another one I'll play around and keep you posted with the solution! thanks a lot
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.