0

I'm running MariaDB 10.3 in a docker container exposed on port 5027. I can connect no problem from DataGrip on localhost:5027. However, .Net Core fails to connect. I am running my .net application directly on the windows host (not in a docker container).

My connection string looks like

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

(For the record, I have also tried 127.0.0.1:5027 with no success)

I'm able to connect to MaraDB running in a virtual machine in HyperV. Why does it fail to connect to my docker container while DataGrip can connect with no issues?

I'm running Docker for Windows, connecting from an ASP.Net Core 2.2 application. My MariaDB image is mariadb:10.3

Has anyone experienced this issue?

Brad
  • 10,015
  • 17
  • 54
  • 77
  • 1
    Possible duplicate of [From inside of a Docker container, how do I connect to the localhost of the machine?](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) – David Maze Dec 09 '18 at 01:19
  • @DavidMaze This question is not the same. Please see in the question where it says "I am running my .net application directly on the windows host" – Brad Dec 12 '18 at 23:47

1 Answers1

0

I found the problem.

The connection string should be Server=localhost;Port=5027;Database=devdb;user=****;password=****

not

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

Brad
  • 10,015
  • 17
  • 54
  • 77