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

An attempt was made to access a socket in a way forbidden by its access permissions(试图以访问权限禁止的方式访问套接字)
本文介绍了试图以访问权限禁止的方式访问套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a website on HostGator and a dedicated server of my own running SQL Server 2008R2. The connection string I use is X.X.X.X,1433 which points to the IP address of my dedicated server. I have made the firewall settings on my server so that I can use SSMS & log into SQL Server from my home PC.

这样做后,我的印象是从我的 hostGator 托管站点连接到 SQL 会正常工作.我收到以下错误:

Having done that, I was under the impression that connecting to SQL from my hostGator hosted-site would work just fine. I receive the following error:

建立网络时发生与网络相关或特定于实例的错误连接到 SQL Server.服务器未找到或无法访问.验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接.(提供者:TCP 提供者,错误:0 - 尝试被以访问权限禁止的方式访问套接字.)

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.)

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

I have looked up this error and found many explanations, but not one dealing with my circumstances. My server is running Windows 2008 w/IIS 7.5. I was assured by HostGator tech support that there would be no problems from their end.]]

我的防火墙允许 TCP 端口 1433,&SQL Server Browser 服务的 UDP 端口 1434.

My firewall allows TCP port 1433, & the UDP port 1434 for the SQL Server Browser service.

由于我有一台专用服务器,我的托管公司没有人可以问这个问题.

Since I have a dedicated server, I have no one to ask this question to from my hosting company.

推荐答案

我遇到了类似的问题,Docker for Windows 和 Hyper-V 保留了端口供自己使用 - 在我的例子中,它是端口 3001 无法访问.

I had a similar issue with Docker for Windows and Hyper-V having reserved ports for its own use- in my case, it was port 3001 that couldn't be accessed.

  • 该端口未被另一个正在运行的进程使用 netstat -ano |管理员 Powershell 提示中的 findstr 3001 什么也没显示.
  • 但是,netsh interface ipv4 show excludeportrange protocol=tcp 显示端口在排除范围之一中.
  • The port wasn't be used by another process- running netstat -ano | findstr 3001 in an Administrator Powershell prompt showed nothing.
  • However, netsh interface ipv4 show excludedportrange protocol=tcp showed that the port was in one of the exclusion ranges.

我能够遵循 Docker for Windows 问题 #3171 中描述的解决方案(无法绑定端口:Docker-for-Windows & Hyper-V 排除但不使用重要端口范围):

I was able to follow the solution described in Docker for Windows issue #3171 (Unable to bind ports: Docker-for-Windows & Hyper-V excluding but not using important port ranges):

  1. 禁用 Hyper-V:

  1. Disable Hyper-V:

dism.exe /Online /Disable-Feature:Microsoft-Hyper-V

  • 在所需的重新启动后,保留您想要的端口,以便 Hyper-V 不会将其保留回来:

  • After the required restarts, reserve the port you want so Hyper-V doesn't reserve it back:

    netsh int ipv4 add excludedportrange protocol=tcp startport=3001 numberofports=1
    

  • 重新启用 Hyper-V:

  • Reenable Hyper-V:

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

  • 在此之后,我能够启动我的 docker 容器.

    After this, I was able to start my docker container.

    这篇关于试图以访问权限禁止的方式访问套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

    本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

    相关文档推荐

    Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
    SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
    SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
    Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
    How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
    How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)