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

前端 未结 2 1126
自闭症患者
自闭症患者 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: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"
    

提交回复
热议问题