日期:2014-05-20  浏览次数:20531 次

关于数据库连接的问题
我的网站程序原来是在.NET   2003下开发的,数据库是sql   server   2000,我安装.net   2005后,把数据库移植到sql   server   2000,修改了相关配置后运行,出现了以下错误,请问怎么解决?
我的连接字符串是: <add   key= "strcnn "   value= "server=localhost;database=rfdatabase;user   id=sa;persist   security   info=True;password=123 "> </add>
---------------------

“/refsite”应用程序中的服务器错误。
--------------------------------------------

在建立与服务器的连接时出错。在连接到   SQL   Server   2005   时,在默认的设置下   SQL   Server   不允许进行远程连接可能会导致此失败。   (provider:   命名管道提供程序,   error:   40   -   无法打开到   SQL   Server   的连接)  
说明:   执行当前   Web   请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。  

异常详细信息:   System.Data.SqlClient.SqlException:   在建立与服务器的连接时出错。在连接到   SQL   Server   2005   时,在默认的设置下   SQL   Server   不允许进行远程连接可能会导致此失败。   (provider:   命名管道提供程序,   error:   40   -   无法打开到   SQL   Server   的连接)

源错误:  


行   84:   if(cnn.State   ==   System.Data.ConnectionState.Closed)
行   85:   {
行   86:   cnn.Open();
行   87:   }
行   88:   }
 

源文件:   E:\rfsite\DataBase\Database.cs         行:   86  

堆栈跟踪:  


[SqlException   (0x80131904):   在建立与服务器的连接时出错。在连接到   SQL   Server   2005   时,在默认的设置下   SQL   Server   不允许进行远程连接可能会导致此失败。   (provider:   命名管道提供程序,   error:   40   -   无法打开到   SQL   Server   的连接)]
      System.Data.SqlClient.SqlInternalConnection.OnError(SqlException   exception,   Boolean   breakConnection)   +734915
      System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject   stateObj)   +188
      System.Data.SqlClient.TdsParser.Connect(Boolean&   useFailoverPartner,   Boolean&   failoverDemandDone,   String   host,   String   failoverPartner,   String   protocol,   SqlInternalConnectionTds   connHandler,   Int64   timerExpire,   Boolean   encrypt,   Boolean   trustServerCert,   Boolean   integratedSecurity,   SqlConnection   owningObject,   Boolean   aliasLookup)   +820
      System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection   owningObject,   SqlConnectionString   connectionOptions,   String   newPassword,   Boolean   redirectedUserInstance)   +628
      System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity   identity,   SqlConnectionString   connectionOptions,   Object   providerInfo,   String   newPassword,   SqlConnection   owningObject,   Boolean   redirectedUserInstance)   +170
      System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions   options,   Object   poolGroupProviderInfo,   DbConnectionPool   pool,   DbConnection   owningConnection)   +359
      System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection   owningConnection,   DbConnectionPool   pool,   DbConnectionOptions   options)   +28
      System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection   owningObject)   +424
      System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection   owningObject)   +66