sql-server - 试图以访问权限禁止的方式访问套接字

标签 sql-server sql-server-2008 sockets tcp

我在 HostGator 上有一个网站和我自己运行 SQL Server 2008R2 的专用服务器。 我使用的连接字符串是 X.X.X.X,1433,它指向我的专用服务器的 IP 地址。 我已经在我的服务器上进行了防火墙设置,以便我可以使用 SSMS 并从我的家庭 PC 登录到 SQL Server。

这样做之后,我的印象是从我的 hostGator 托管站点连接到 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 - An attempt was made to access a socket in a way forbidden by its access permissions.)

我查了这个错误并找到了很多解释,但没有一个是针对我的情况的。 我的服务器运行的是带 IIS 7.5 的 Windows 2008。 HostGator 技术支持向我保证,他们不会有任何问题。]]

我的防火墙允许 TCP 端口 1433 和 UDP 端口 1434 用于 SQL Server 浏览器服务。

因为我有一台专用服务器,所以没有人向我的托管公司提出这个问题。

最佳答案

Windows 版 Docker 和 Hyper-V 都有类似的问题,它们保留了供自己使用的端口 - 在我的例子中,端口 3001 无法访问。

  • 该端口未被另一个正在运行的进程使用 netstat -ano |管理员 Powershell 提示符中的 findstr 3001 未显示任何内容。
  • 但是,netsh interface ipv4 show excludedportrange protocol=tcp 显示端口在排除范围之一。

我能够遵循 Docker for Windows 问题 #3171 ( Unable to bind ports: Docker-for-Windows & Hyper-V excluding but not using important port ranges ) 中描述的解决方案:

  1. 禁用 Hyper-V:

    dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
    
  2. 在必要的重启后,保留您想要的端口,这样 Hyper-V 就不会再保留它了:

    netsh int ipv4 add excludedportrange protocol=tcp startport=3001 numberofports=1
    
  3. 重新启用 Hyper-V:

    dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
    

之后,我就可以启动我的 docker 容器了。

关于sql-server - 试图以访问权限禁止的方式访问套接字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15619921/

相关文章:

sql-server - 连接另外两个表的表的名称是什么?

sql-server - 如何在 MS SQL-Server 上查找具有特殊字符(如 'José')的名称

sql - 按时间间隔(例如天)和总持续时间对时间序列进行分组

sql - 在 SQL Server 2008 上运行 'ALTER DATABASE SET SINGLE_USER' 语句所需的权限

node.js - Socket.io:如何正确加入和离开房间

c# - Entity Framework 6,命令拦截和存储过程

sql - EXEC sp_who2 - LastBatch?

asp.net - SQL 网络接口(interface),错误 : 26 - Error Locating Server/Instance Specified

c# - HTTP Web 请求的欺骗 IP 地址?

c - 在 C 编程语言中,在 telnet session 中获取按键的正确方法是什么?