我有docker将文件组成为:
version: "3.8"
services:
web:
build: .
ports:
- "8019:80"
depends_on:
- db
db:
image: "mcr.microsoft.com/mssql/server"
environment:
SA_PASSWORD: "Mypassword123!"
ACCEPT_EULA: "Y"
Db连接字符串为:
"DefaultConnection": "Server=db;Database=Client;User=SA;Password=Mypassword123!;"
但它抛出了一个错误:
ExtendedSocketException:名称或服务未知
https://i.stack.imgur.com/CGBcN.png
看起来像是防火墙问题。你的数据库在Azure中吗?如果是这样,请转到防火墙页面,并添加您尝试连接的系统的IP地址。