首页 文章

.Net Core无法连接到在docker容器中运行的MariaDB

提问于
浏览
-1

我在端口5027上暴露的docker容器中运行MariaDB 10.3 . 我可以在localhost:5027上从DataGrip连接没问题 . 但是,.Net Core无法连接 . 我直接在Windows主机上运行我的.net应用程序(而不是在docker容器中) .

我的连接字符串看起来像

Server=localhost:5027;Database=devdb;user=****;password=****

(为了记录,我也尝试过127.0.0.1:5027但没有成功)

我能够连接到HyperV中虚拟机中运行的MaraDB . 为什么DataGrip可以连接没有问题时无法连接到我的docker容器?

我正在运行Docker for Windows,从ASP.Net Core 2.2应用程序连接 . 我的MariaDB图片是 mariadb:10.3

有没有人遇到过这个问题?

1 回答

  • 0

    我发现了问题 .

    连接字符串应为 Server=localhost;Port=5027;Database=devdb;user=****;password=****

    Server=localhost:5027;Database=devdb;user=****;password=****

相关问题