Can't connect to SQL Server express from .net core app running on docker

前端 未结 2 1127
自闭症患者
自闭症患者 2021-01-20 13:57

I have SQL Server 2016 Express, docker for Windows and IIS installed on my Windows 10 machine.

SQL Server Express is configured to listen on 1455 port. The Northwind

相关标签:
2条回答
  • 2021-01-20 14:00

    The problem was I didn't disable Windows Firewall correctly.

    I turned off Windows Firewall, but only on Domain networks. Windows sees the DockerNAT adapter as a public network. So Windows firewall was blocking the connection to SQL Server.

    I turned off Windows Firewall on public networks and I can connect now.

    0 讨论(0)
  • 2021-01-20 14:17

    You can try to start the container using network mode as host. In that case the container can connect to applications running on the host machine using localhost as a DNS name.

    version: '3'
    
    services:
      connectsqlserver:
        image: connectsqlserver
        build:
          context: ./ConnectSqlServer
          dockerfile: Dockerfile
        network_mode: "host"
    
    0 讨论(0)
提交回复
热议问题