✅ 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.
11 Replies
what is error 40?
This error dude
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
Yeb, this is the same network, and the dbhost is sql-server
and
sql-server
is definitely the service name in your compose file?
can you ping it from the API container?When i run ping command, it say ping is not found
Yes, it is
what happens if you try to connect using the container IP instead of the service name?
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
can you access the sql server container from another program?
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•7mo ago
Message Not Public
Sign In & Join Server To View