C
C#7mo ago
khauvannam

✅ error 40 in sql server docker and ef core

Has anyone used SQL Server in Docker and encountered error 40 when connecting from another container (a web API controller)? However, when running the web API in IIS, it connects to the SQL Server just fine. Thank you in advance.
No description
11 Replies
Jimmacle
Jimmacle7mo ago
what is error 40?
khauvannam
khauvannamOP7mo ago
This error dude
No description
Jimmacle
Jimmacle7mo ago
what's your connection string? are the containers in the same docker network? https://docs.docker.com/compose/networking/ it's ultimately a network issue
khauvannam
khauvannamOP7mo ago
Yeb, this is the same network, and the dbhost is sql-server
No description
No description
Jimmacle
Jimmacle7mo ago
and sql-server is definitely the service name in your compose file? can you ping it from the API container?
khauvannam
khauvannamOP7mo ago
When i run ping command, it say ping is not found Yes, it is
Jimmacle
Jimmacle7mo ago
what happens if you try to connect using the container IP instead of the service name?
khauvannam
khauvannamOP7mo ago
Same error occur, actually, the same error happens with localhost, ip address, service name The one i just not try is tcp:service-name,1433 but i think it still return the same problem, i think my web api container can not access to the sql server container
Jimmacle
Jimmacle7mo ago
can you access the sql server container from another program?
khauvannam
khauvannamOP7mo ago
I try to access it from the iis and it fine, i use other method which just return string from the web api service and it still ok I have dm you a message, can u check it
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server