在网上找资料和解决方案 找了一天了都没有解决。网上说的所有解决方案都没有其效果。与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接) 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)源错误: 
行 112:            SqlDataAdapter sqlad= new SqlDataAdapter(comm);
行 113:            DataSet ds=new DataSet();
行 114:            sqlad.Fill(ds);
行 115:            return ds;
行 116:            
 源文件: F:\vs2008\wf\DB.SQLServer\DB.SQLServer\SQLServer.cs    行: 114 堆栈跟踪: 
[SqlException (0x80131904): 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844759
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194 

解决方案 »

  1.   

    配置管理器-启用tcp/ip
    防火墙打开1433端口
      

  2.   

    这个方法已经用过  没有效果啊  
    我的是  2003的操作系统  vs2008  mssql2005
      

  3.   

    估计你开的不是1433吧,到Configration Manager中看一下你用的哪个端口
      

  4.   

    这个问题是数据的访问方式不正确,我当时也碰到了。
    sql的访问SqlDataAdapter 是不能这样直接更新数据的,可能你的数据库表有主键限制。
    好好的看下表结构和SqlDataAdapter 访问模式。
      

  5.   

    Is SQL Server sitting outside your DMZ??? That is, SQL Server is actually accessible directly on the Internet?!?!Usually Sys Admin would never allow this sort of configuration. My take is that your SQL Server is inside the LAN and you need to do port-forwarding from your DMZ and punch a hole through the firewall to reach your SQL Server.
      

  6.   

    Is SQL Server sitting outside your DMZ??? That is, SQL Server is actually accessible directly on the Internet?!?!Usually Sys Admin would never allow this sort of configuration. My take is that your SQL Server is inside the LAN and you need to do port-forwarding from your DMZ and punch a hole through the firewall to reach your SQL Server.