首页 > 解决方案 > 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 Management studio 总是给出以下错误:

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 使用的驱动程序是否存在忽略此端口转发的内容?

标签: sql-servernetsh

解决方案


我想通了:监听地址为 localhost 的 portproxy 不起作用,但 127.0.0.1 可以。


推荐阅读