为什么我会收到"无法连接到服务器 - 与网络相关的或特定于实例的错误和QUOT ;? [英] Why am I getting "Cannot Connect to Server - A network-related or instance-specific error"?

查看:288
本文介绍了为什么我会收到"无法连接到服务器 - 与网络相关的或特定于实例的错误和QUOT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试连接到SQL Server的时候出现以下错误:


  

无法连接到108.163.224.173。


  
  

一个网络相关的或
  在建立连接时出现特定实例的错误
  SQL Server中。


  
  

服务器未找到或无法访问。校验
  实例名称是否正确,以及SQL Server配置
  允许远程连接。


  
  

(provider:命名管道提供程序,error:40 -
  无法打开到SQL Server)(微软SQL Server的连接,
  错误:1326)


当我尝试配置我的数据库,GridView控件在Visual Studio 2010中我在一个不知如何调试这个错误这个错误被抛出。

你会如何调试这个错误?我应该采取什么步骤,以确定究竟怎么回事就在这里,除了在错误消息中提到的一个?


解决方案

我发现下面的技巧,:


  • 需要检查,以解决发生网络相关的或特定实例错误建立SQL Server的连接......:



    1.   

      请确保您的数据库引擎的配置为接受远程连接


        
        

          
      • 开始>所有程序>的SQL Server 2005>配置工具> SQL Server外围应用配置

      •   
      • 单击上外围应用配置服务和连接

      •   
      • 选择是有实例的问题>数据库引擎>远程连接

      •   
      • 启用本地和远程连接

      •   
      • 重新启动实例

      •   



    2.   

      您可能需要为防火墙作为SQL Server实例和端口使用的是上创建一个例外:


        
        

          
      • 开始>运行> FIREWALL.CPL

      •   
      • 单击例外选项卡

      •   
      • 添加SQLSERVR.EXE(通常位于 C:\\ Program Files文件(x86)的\\ Microsoft SQL Server的\\ MSSQL.X \\ MSSQL \\ BIN ,请检查您的安装实际文件夹路径)和端口(默认为 1433

      •   
      • 检查您的连接字符串以及

      •   



  • 从<一个href=\"http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/\">FIX :错误:无法打开到SQL Server 连接:

    <醇开始=3>

  •   

    检查您的 SQL Server服务启动并运行正确的:


      
      

        
    • 转到所有程序> Microsoft SQL Server 2008中>配置工具> SQL Server配置管理器> SQL Server服务

    •   
    • 检查以确保SQL Server服务的状态正在运行。

    •   

      
      

    此外,确保您的远程服务器是在同一网络中。如果您的服务器包含在您的网络列表中运行 SQLCMD -L 确定。




  •   

    在SQL Server配置启用TCP / IP


      
      

    当两个或多个SQL服务器都通过网络连接它们在使用TCP / IP的所有通信。安装SQL Server的默认端口是1433,该端口可以通过SQL Server配置管理器进行更改。的TCP / IP应为所连接的SQL Server被启用。


      
      

        
    • 转至所有程序>>的Microsoft SQL Server 2008 >>配置工具>> SQL Server配置管理>>选择TCP / IP

    •   
    • 右键单击TCP / IP >>点击启用

    •   

      
      

    您必须重新启动SQL Server服务的所有更改生效。点击右键,进入菜单属性中选择位置,SQL Server的默认端口是可以改变的。




I get the following error when trying to connect to SQL Server:

Cannot connect to 108.163.224.173.

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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 1326)

This error is thrown when I try to configure my database to gridview in Visual Studio 2010. I'm at a loss as to how to debug this error.

How would you debug this error? What steps should I take in order to determine what is really going on here, in addition to the one mentioned in the error message?

解决方案

I found the following techniques helpful:

  • From 7 things to check to resolve "A network-related or instance-specific error occurred while establishing a connection to SQL Server…":

    1. Make sure your database engine is configured to accept remote connections:

      • Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
      • Click on Surface Area Configuration for Services and Connections
      • Select the instance that is having a problem > Database Engine > Remote Connections
      • Enable local and remote connections
      • Restart instance

    2. You may need to create an exception on the firewall for the SQL Server instance and port you are using:

      • Start > Run > Firewall.cpl
      • Click on exceptions tab
      • Add sqlservr.exe (typically located in C:\Program Files (x86)\Microsoft SQL Server\MSSQL.x\MSSQL\Bin, check your installs for the actual folder path) and port (default is 1433)
      • Check your connection string as well

  • From FIX : ERROR : Could not open a connection to SQL Server:

    1. Check if your SQL server services is up and running properly:

      • Go to All Programs > Microsoft SQL Server 2008 > Configuration Tools > SQL Server Configuration Manager > SQL Server Services
      • Check to make sure SQL Server service status is Running.

      In addition, ensure that your remote server is in the same network. Run sqlcmd -L to ascertain if your server is included in your network list.

    2. Enable TCP/IP in SQL Server Configuration

      When two or more SQL Servers are connected across network they do all communication using TCP/IP. The default port of SQL Server installation is 1433. This port can be changed through SQL Server Configuration Manager. TCP/IP should be enabled for SQL Server to be connected.

      • Go to All Programs >> Microsoft SQL Server 2008 >> Configuration Tools >> SQL Server Configuration Manager >> Select TCP/IP
      • Right Click on TCP/IP >> Click on Enable

      You must restart SQL Server Services for all the changes to take effect. Right click and go to menu properties to select location where default port of SQL Server can be changed.

这篇关于为什么我会收到&QUOT;无法连接到服务器 - 与网络相关的或特定于实例的错误和QUOT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆