netsh 端口代理并不总是适用于 SQL Server

问题描述

我有一台在 Parallels 中运行 Windows 10 21H1 的 Mac。在 macOS 上,我在 Docker 容器中运行 sql Server,在端口 55556 上公开。 在 Windows 中,我试图将 localhost,55555 转发到 Docker 中的 sql Server。
为此,我尝试了 netsh interface portproxy add v4tov4 listenaddress=localhost listenport=55555 connectaddress=10.211.55.2 connectport=55556,但这仅在连接 Datagrip 时有效(在 Windows VM 中,使用 JDBC 驱动程序);我可以查看所有数据库查询它们等
sql 管理工作室总是给出以下错误

A network-related or instance-specific error occurred while establishing a connection to sql Server. The server was not found or was not accessible. Verify that the instance name is correct and that sql Server is configured to allow remote connections. (provider: TCP Provider,error: 0 - The wait operation timed out.) (Microsoft sql Server,Error: 258)

sql Management Studio 使用的驱动程序是否存在忽略此端口转发的内容

解决方法

我想通了:具有侦听地址 localhost 的 portproxy 不起作用,但 127.0.0.1 起作用。