我的服务器上有一些旧数据库,因此将旧的、未使用的数据库脱机。
这导致了一个非常奇怪的问题,因为我的网站抱怨无法连接到这些数据库之一。
我已经在整个代码库中搜索了数据库名称以及服务器上的所有配置文件,但它们都没有引用这个数据库名称,但是如果我脱机,我会收到错误消息?
我无法从错误中看到实际发出连接请求的内容,除了它看起来与 SQL 会话服务器有关。
[SqlException (0x80131904):无法打开数据库“MyOldDatabaseName”,因为它处于脱机状态。]
System.Data.SqlClient.SqlConnection.OnError(SqlException 异常,布尔型 breakConnection)+1953274
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException 异常, Boolean breakConnection) +4849707
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data .SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +96
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
System.Data.SqlClient .SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data。 SqlClient.SqlCommand.ExecuteReader(CommandBehavior 行为,字符串方法)+141
System.Data.SqlClient.SqlCommand.ExecuteReader()+89
System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) +516[HttpException (0x80004005): 无法连接到 SQL Server 会话数据库。]
System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e) +229
System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) +649
System.Web.SessionState.SqlSessionStateStore.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) +48
System.Web .SessionState.SessionStateModule.GetSessionStateItem() +117 System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb,对象额外数据)+487
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +66 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155