为什么在本机使用IP连接SQL2005数据库可以正常,可是在别人电脑上就会出现如下错误,网上的方法都试过了,可是还是不可以,有谁知道是什么问题吗? 
有关调用实时(JIT)调试而不是此对话框的详细信息, 
请参见此消息的结尾。 ************** 异常文本 ************** 
System.Data.SqlClient.SqlException: 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: SQL 网络接口, error: 26 - 定位指定的服务器/实例时出错) 
  在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 
  在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 
  在 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) 
  在 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) 
  在 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) 
  在 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) 
  在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) 
  在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) 
  在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) 
  在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) 
  在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) 
  在 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) 
  在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) 
  在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) 
  在 System.Data.SqlClient.SqlConnection.Open() 
  在 管理系统.系统登陆.Login_Click(Object sender, EventArgs e) 
  在 System.Windows.Forms.Control.OnClick(EventArgs e) 
  在 System.Windows.Forms.Button.OnClick(EventArgs e) 
  在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) 
  在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) 
  在 System.Windows.Forms.Control.WndProc(Message& m) 
  在 System.Windows.Forms.ButtonBase.WndProc(Message& m) 
  在 System.Windows.Forms.Button.WndProc(Message& m) 
  在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) 
  在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
  在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 
************** 已加载的程序集 ************** 
mscorlib 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll 
---------------------------------------- 
管理系统 
    程序集版本: 1.0.0.0 
    Win32 版本: 1.0.0.0 
    基本代码:  file:///E:/Users/zxy/Desktop/管理系统.exe 
---------------------------------------- 
Microsoft.VisualBasic 
    程序集版本: 8.0.0.0 
    Win32 版本: 8.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll 
---------------------------------------- 
System 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll 
---------------------------------------- 
System.Windows.Forms 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll 
---------------------------------------- 
System.Drawing 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll 
---------------------------------------- 
System.Runtime.Remoting 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll 
---------------------------------------- 
System.Data 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll 
---------------------------------------- 
System.Configuration 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll 
---------------------------------------- 
System.Xml 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll 
---------------------------------------- 
System.Transactions 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll 
---------------------------------------- 
System.EnterpriseServices 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll 
---------------------------------------- 
System.Data.resources 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_MSIL/System.Data.resources/2.0.0.0_zh-CHS_b77a5c561934e089/System.Data.resources.dll 
---------------------------------------- 
mscorlib.resources 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll 
---------------------------------------- 
System.Windows.Forms.resources 
    程序集版本: 2.0.0.0 
    Win32 版本: 2.0.50727.1434 (REDBITS.050727-1400) 
    基本代码:  file:///D:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_zh-CHS_b77a5c561934e089/System.Windows.Forms.resources.dll 
---------------------------------------- ************** JIT 调试 ************** 
要启用实时(JIT)调试, 
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置 
jitDebugging 值。 
编译应用程序时还必须启用 
调试。 例如: <configuration> 
    <system.windows.forms jitDebugging="true" /> 
</configuration> 启用 JIT 调试后,任何无法处理的异常 
都将被发送到在此计算机上注册的 JIT 调试器, 
而不是由此对话框处理。

解决方案 »

  1.   

    Sql Server 2005的1433端口打开和进行远程连接
    如何打开sql server 2005 的1433端口配置工具->Sql Server Configuration Manager->MSSQLSERVER的协议看看TCP/IP协议是否启动,如果启动,右键菜单点"属性" ,在分页菜单中选"IP地址",把"IP1"和"IP2"中"TCP端口"为1433,"已启用"改为"是"配置工具->Sql Server Configuration Manager->SQL Native Client 配置->客户端协议->TCP/IP选择TCP/IP右键菜单中"属性",确认"默认端口"是1433,"已启用"为"是"
    SQL Server 2005 远程连接配置TCP/IP属性. 
    Surface Area Configuration --> Database Engine --> Remote Connections --->Using TCP/IT SQL Server 外围应用配置器—服务和连接外围配置—database englie—远程连接—启用(远程连接的TCP/IP和named pipes)  
    SQL Server Configuration Manager—SQL2005网络配置—启用TCP/IP和named pipes
    -----------------------------------------------------------------------------------------
    一般按如上即可. 其他说明见下: 
    sqlserver2005(Express版),为了便于管理,你还需要去下一个manage管理器,微软的官方网站有 
    下,安装好manage管理器后,在程序中连接sqlserver2005,下面几点是要注意的。 
          1. 开启sql2005远程连接功能,开启办法如下, 
              
    配置工具->sql 
    server外围应用配置器->服务和连接的外围应用配置器->打开MSSQLSERVER节点下的Database Engine 
    节点,先择"远程连接",接下建议选择"同时使用TCP/IP和named pipes",确定后,重启数据库服务就可以了. 
          2.登陆设置改为,Sql server and windows Authentication方式同时选中,具体设置如下: 
            
    manage管理器->windows 
    Authentication(第一次用windows方式进去),->对象资源管理器中选择你的数据服务器--右键>属 
    性>security>Sql server and windows Authentication方式同时选中. 
          3:设置一个Sql server方式的用户名和密码,具体设置如下: 
        manage管理器->windows Authentication>new query>sp_password null,'sa123456','sa' 
        这样就设置了一个用户名为sa ,密码为:sa123456的用户,下次在登陆时,可以用Sql server方式, 
    用户名为sa ,密码为:sa123456的用户进数据库了. 
          4: 做完上面三步后,这样写连接字符串就可以顺利进入数据库了, 
            (server=.\\sqlexpress;uid=sa;pwd=sa123456;database=master"; 
    其它版本,做如下設置 程序—Microsoft SQL Server 2005—配置工具—SQL Server 外围应用配置器—服务和连接的外围应用配置器— 
    1、MSSQLserver(实例名)—DataBase Engine—远程连接—(设置选项) 
    在下方选项 
    2、SQL Server Browser—服务(停止时只本机访问) 
    3、程序—Microsoft SQL Server 2005—配置工具—SQL Server Configuration Manager—网络连接协议-选择实例对应协议—启用(shard memory、Named Pipes、TCP\IP) 
    注: SQL Server 浏览器程序以服务的形式在服务器上运行。SQL Server 浏览器侦听对 Microsoft SQL Server 资源的传入请求,
    并提供计算机上安装的 SQL Server 实例的相关信息。
    SQL Server 浏览器可用于执行下列三种操作: 
    浏览可用服务器 
    连接到正确的服务器实例 
    连接到专用管理员连接 (DAC) 端点 
    SQL Server Browser 服务 (sqlbrowser) 为数据库引擎 和 SSAS 的每个实例提供实例名称和版本号。
    SQL Server 浏览器随 Microsoft SQL Server 2005 一起安装,
    为该计算机上运行的早期版本的 SQL Server(从 Microsoft SQL Server 7.0 开始)提供此服务。
      

  2.   

    上面的方法都试过了,可是开始不可以,远程还是连接不上我在别人电脑上输入 telnet IP 1433
    会提示 不能打开到主机连接,在端口1433:连接失败
      

  3.   

    我用netstat -an看了下本地找不到1433端口有在侦听,怎么回事呀
      

  4.   

    SQL Server  Configuration Manager>SQL2005网络配置>协议>tcp/ip>属性>ipall>删除TCP动态端口,然后自己指定端口再试。
      

  5.   

    你的机器上是不是还装了其它版本的sqlserver呀