【发布时间】:2021-02-15 09:02:48
【问题描述】:
我应该使用什么连接字符串从我的 Docker 容器(.NET Core 应用程序)连接到安装在主机 Droplet 上的 PostgreSQL 数据库。容器和数据库都在同一个液滴上。 导航到该网站有效,但出现错误:
加载资源失败:服务器响应状态为 400 (错误请求)
尝试与数据库通信时。
这是我的连接字符串:
"ConnectionStrings": {
"DefaultConnection": "host=;database=my_db;username=username;password=password"
}
我已经尝试了连接字符串中主机部分的公共 IP 和私有 IP,但都不起作用。
这里应该用什么?
[https://www.digitalocean.com/community/questions/can-t-communicate-from-docker-container-net-core-app-to-postgresql-on-host-droplet?utm_content=can- t-communicate-from-docker-container-net-core-app-to-postgresql-on-host-droplet&utm_medium=community&utm_source=linkshare][1]
【问题讨论】:
标签: postgresql docker containers asp.net-core-webapi droplet