0

I got the following error while running a windows service in one of the environments in my project:

Error Message:

An error occurred while executing the command definition. See the inner exception for details.

Inner Exception Message:

Invalid object name 'dbo.ProcessTracker'.

Stack Trace:

 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   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, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   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.ExecuteReader(CommandBehavior behavior)
   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
   at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)

I have made sure that such a table exists in the database that the service is connecting to. Also, the same service is installed in other environments/servers and is working fine.

We are using EF 6 Can anyone please help me with this?

13
  • One more additional information. I tried connecting to the same database running the service code(it's a topshelf service) from my local machine and got the same error. However, I used the same connection details to log into the db from SSMS and I found that the table is existing under the dbo. schema. Commented Feb 19, 2015 at 14:47
  • Are you absolutely positive the service is connecting to the correct database? Commented Feb 19, 2015 at 14:48
  • It might be a silly question to ask, but how do I ensure that the service is connecting to the database. It certainly is not loading any tables, but if it were unable to connect at all, wouldn't it have thrown an "unable to connect" exception at initialization itself? Commented Feb 19, 2015 at 14:52
  • Can you show the connection string you are using? You can try stopping the server and if the app still reports the same error, you know it's not trying to connect to the right place. Commented Feb 19, 2015 at 14:52
  • It's staging environment and prep work is going on for UAT. Lot of other teams are testing their components. So stopping server is out of scope. I will post the connection string shortly. Commented Feb 19, 2015 at 14:57

1 Answer 1

1

Folks,

The issue turned out to be with the connection string in configuration file. There was an error in the config file which caused this issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.