Invalid object name 'Hangfire.Set'

Hi, I’m new using Hangfire, I installed on my development machine and in a test server and it was working fine, now on my server I’m having this error:

Invalid object name 'Hangfire.Set'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'Hangfire.Set'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[SqlException (0x80131904): Invalid object name 'Hangfire.Set'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1787814
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5341674
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +546
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1693
System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
System.Data.SqlClient.SqlDataReader.get_MetaData() +90
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +377
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1421
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +137
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
Dapper.<QueryImpl>d__11`1.MoveNext() +370
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +381
System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
Dapper.SqlMapper.Query(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) +379
Hangfire.SqlServer.SqlServerConnection.GetRangeFromSet(String key, Int32 startingFrom, Int32 endingAt) +95
Hangfire.Storage.StorageConnectionExtensions.GetRecurringJobs(JobStorageConnection connection, Int32 startingFrom, Int32 endingAt) +29
Hangfire.Dashboard.Pages.RecurringJobsPage.Execute() +353
Hangfire.Dashboard.RazorPage.TransformText(String body) +26
Hangfire.Dashboard.RazorPage.ToString() +7

The database was created and I can enter to the dashboard, but when I click on the menu items Retries and Recurring Jobs the exception is throw. Any Idea?

Hello,

I just felt on the same issue here, it seems that the 1.4.2 version of Hangfire is not consistent regarding the naming “case” used to initialize tables and then for queries.

I changed the collation of my local database for a case insensitive options, it now works.
But keep in mind that this is not recommanded since if your production is case sensitive, you WILL get surprises.

I hope they can fix this for next version.

Can you send a pull request agains the master branch? I’ll incorporate the changes into Hangfire 1.4.3.

Yes, that was the problem, by default my MSSQL 2008 R2 was creating the databases by default with a case-sensitive collation, note aside my MSSQL 2012 is working OK.

Pull request was submitted for this to be put into 1.4.3 target :slight_smile:

1 Like

To close the topic – all the changes required to use Hangfire in case sensitive collations shipped with 1.4.3. Thank you @ilessa very much!