是否有可能在Azure Devops中使用两个相互通信的service containers。以下对我不起作用:
resources:
containers:
- container: sql
image: mcr.microsoft.com/mssql/server
ports:
- 8080:80
env:
SA_PASSWORD: "*****"
ACCEPT_EULA: "Y"
- container: api
image: my-api:latest
ports:
- 8080:80
env:
connectionString: "Server=tcp:sql,1433;Initial Catalog=my-db;Persist Security Info=False;User ID=sa;Password=*****;MultipleActiveResultSets=False;Connection Timeout=30;"
services:
sql: sql
api: api
pool:
vmImage: 'ubuntu-16.04'
steps:
- script: |
ping localhost -c 10
curl localhost:8080
运行此命令时,出现以下错误:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
##[error]Bash exited with code '7'.
api无法连接sql服务。当我使用连接字符串连接到Azure sql数据库时,它可以正常工作。我在连接字符串中尝试了服务容器名称(sql,1433)和(localhost,1433)。