2011-06-28 42 views
0

就在今天,我無處不在,開始出現這個錯誤;SQL Server 2005中的對象名稱錯誤

SourceName: ASP.NET 2.0.50727.0 

Time: 20110628094209.000000+060 

Message: Event code: 3005 Event message: 

An unhandled exception has occurred. Event time: 28/06/2011 09:42:09 Event time (UTC): 28/06/2011 08:42:09 Event ID: 8543b22dbcdc4b37a7b456c378c43e71 Event sequence: 2 Event occurrence: 1 Event detail code: 0 Application information: 

Application domain: /LM/W3SVC/1001/ROOT-1-129537072751067040 Trust level: Full Application Virtual Path:/Application Path: C:\SomePath Machine name: 227605-WEB2 Process information: 

Process ID: 4352 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception information: 

Exception type: SqlException Exception message: 

Invalid object name 'SomeTable'. Request information: 

Request URL: http://www.somewebsite.com/ Request path:/User host address: 90.152.59.206 User: SomeUser Is authenticated: False Authentication Type: SomeType Thread account name: NT AUTHORITY\NETWORK SERVICE Thread information: 

Thread ID: 6 Thread account name: NT AUTHORITY\NETWORK SERVICE Is impersonating: False Stack trace: at 

System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at 

System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at 

System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at 

System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at 

System.Data.SqlClient.SqlDataReader.get_MetaData() at 

System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at 

System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at 

System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at 

System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at 

System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at 

System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at 

System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() at 

NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) at 

NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) at 

NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at 

NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at 

NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) Custom event details: 

據我所知,我見過有人在談論權限問題。 而且我們昨天剛剛重新啓動服務器。 它可能是我們在重新啓動後丟失的東西嗎?

這是我們的連接字符串(我們使用的是NHibernate);

<property name="connection.connection_string">Database=SomeDatabase;Data Source=SomeDataSource,1433;User ID=SomeUserId;Password=SomePassword;Integrated Security=false;</property> 

如果您需要查看其他內容,請讓我知道。 謝謝, Bilsay

回答

0

事實證明,這實際上是一個簡單的問題。 在我們的應用程序中,我們剛剛開始訪問多個數據庫,因此在我們的一個查詢中,我們必須首先說'Use SomeDatabase;'或者將'Initial Catalog = SomeDatabase'添加到我們的連接字符串中也可能起作用。

無論如何,這個例外實際上是在說什麼正在發生。 那時基本上是在查看不同的數據庫。因此我們確保每個查詢都在正確的數據庫中執行。 即使那個NHibernate爲你做默認數據庫的事情,我只是猜測使用本機sql可能已經使問題複雜化了。

Bilsay