System.Data.SqlClient.SqlException: Hangfire database migration script failed: CREATE SCHEMA failed due to previous errors

I’m having trouble getting Hangfire to work to our SQL instance - Ultimately the SQL error being thrown seems to be:
Error Number:50000 State:1 Class:11

I haven’t been able to track down what this error code means yet, but have verified:

  • The Account the website is running on DOES have rights to the DB (EF Core being used in the app, and is working fine using Integrated Security)
  • Hangfire is working fine using LocalDB in development.

Here’s the stack trace:
System.Data.SqlClient.SqlException: Hangfire database migration script failed: CREATE SCHEMA failed due to previous errors. Changes were rolled back, please fix the problem and re-run the script again.
Installing Hangfire SQL objects…
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 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.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action2 paramReader) at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable1 commandTimeout, Nullable`1 commandType)
at Hangfire.SqlServer.SqlServerObjectsInstaller.Install(DbConnection connection, String schema)
at Hangfire.SqlServer.SqlServerStorage…ctor(String nameOrConnectionString, SqlServerStorageOptions options)
at Hangfire.SqlServerStorageExtensions.UseSqlServerStorage(IGlobalConfiguration configuration, String nameOrConnectionString)
at Hangfire.HangfireServiceCollectionExtensions.GetInitializedJobStorage(IServiceProvider serviceProvider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.b__0(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Hangfire.HangfireApplicationBuilderExtensions.UseHangfireDashboard(IApplicationBuilder app, String pathMatch, DashboardOptions options, JobStorage storage)
at EI.Reporting.Web.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\development\eiReporting\EI.Reporting\EI.Reporting.Web\Startup.cs:line 100
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
ClientConnectionId:9b810b28-7143-4012-9d8f-76ad231a33dc
Error Number:50000,State:1,Class:11

Thanks in advance for any input!

Hangfire has some restrictions about Sql Server version. If your server is old enough (older than 2008, if I recall correctly), some scripts will fail because of unsupported syntax or missing data types.
If you have Sql Server 2008 or newer, you might also check your DB’s compatibilty level. Compatibility with very old versions might also prevent scripts from running correctly.

Checked in on this, we’re running SQL Server 2008R2, which may be the cause of the issues.

Thanks!