web应用程序连接不上数据库的问题,急!!!
一个在本地调试可以连接数据库的web应用程序 在WINDOWS SERVER 2008 + SQL SERVER 2005的服务器上就连不上数据库了开发时是用的SQL SERVER EXPRESS数据库,后来在服务器上重新建立了SQL server的数据库,同样不行,用这个程序连接SQL自带的系统数据库同样出这个问题,本以为会出现表不存在等其他问题,现在请教各位大大,到底是哪里的问题。。。。
在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: SQL 网络接口, error: 26 - 定位指定的服务器/实例时出错)
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: SQL 网络接口, error: 26 - 定位指定的服务器/实例时出错)
堆栈跟踪:
[SqlException (0x80131904): 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: SQL 网络接口, error: 26 - 定位指定的服务器/实例时出错)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844759
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4858065
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +376
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4859187
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +115
DAL.ACMWEBDataSetTableAdapters.newsTableAdapter.GetAllNews() +135
BLL.News.GetAllNews() +48
_DefaultIndex.RepeaterDataBind() +60
_DefaultIndex.Page_Load(Object sender, EventArgs e) +450
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
程序所使用的数据库连接字段
<add name="ACMWebConnectionString" connectionString="Data Source=(local);User Id=sa;Password=Test1234;Initial Catalog=ACMWEB;" />
Data Source改成127.0.0.1也不行
SQL SERVER 2005已经在外围服务器配置里按照网上所说的配置好了
但是还是出这个错误 --------------------编程问答-------------------- Data Source=实例名 --------------------编程问答-------------------- 你可以用个数据源控件,去连接,然后用它生成的数据库连接字符串。就可以了。 --------------------编程问答-------------------- "Data Source=(local);Database=ACMWEB;Uid=sa;Pwd=Test1234"试下 --------------------编程问答--------------------
简单而有效的方法 --------------------编程问答--------------------
是连接字符串的问题么? --------------------编程问答-------------------- 他告诉你实例名有问题。
一般是:ip\SQLExpress或者.\SQLExpress
SQLExpress是数据库实例名。 --------------------编程问答-------------------- 但是一般默认实例名的话是不需要后面的实例的。
从你的情况上讲,应该是有实例名。 --------------------编程问答-------------------- 把具体的连接的贴出来 --------------------编程问答-------------------- 这个程序在开发的时候,用的是SQL EXPRESS做的,后来服务器上没有EXPRESS,于是就在SQL SERVER上建了一个,但是现在就连不上建的这个数据库 。。。 --------------------编程问答--------------------
什么具体的连接? --------------------编程问答-------------------- 允许TCP/IP和命名管道是否设置
Sql Server Browser是否启动
SQL的登陆方式,选用混合方式
连接字符串问题,服务器名和数据库是否正确
Server=127.0.0.1/SQLEXPRESS --------------------编程问答--------------------
你说的这些都设置好了 。。。 但还是不行
对了,我现在是自己弄了个虚拟机,在虚拟机上调试的 --------------------编程问答-------------------- 你的错误是:
服务器/实例出错.
有时用localhost就会出现error:26.
1.在外围配置里面,远程连接选择:同时使用TCP/IP和named pipes.
若没解决进行下一步.
2.例如果你sql上是zss\SQLEXPRESS
配置是不要写localhost\\SQLEXPRESS,要写zss\\SQLEXPRESS.
100%成功! --------------------编程问答--------------------
我试试吧 --------------------编程问答--------------------
不行。。 --------------------编程问答-------------------- upup。。
补充:.NET技术 , ASP.NET