Environment:
.Net 5.0
Docker
SQL Server 2019
Hangfire: 1.17.28
Works with non-dockersized execution. But having issues with Docker.
Successfully connecting to SQL Server with .UseSqlServerStorage(connectionString, options) but
Enqueing Job from Docker Container getting the below error.
Hangfire.BackgroundJobClientException: Background job creation failed. See inner exception for details.\n —>
System.Data.SqlClient.SqlException (0x80131904): Array cannot be null. (Parameter ‘bytes’)\n
at System.Text.Encoding.GetString(Byte[] bytes)\n
at System.Text.UTF8Encoding.UTF8EncodingSealed.GetString(Byte[] bytes)\n
at System.Data.SqlClient.SNI.SNIProxy.GenSspiClientContext(SspiClientContextStatus sspiClientContextStatus, Byte[] receivedBuff, Byte[]& sendBuff, Byte[] serverName)\n
at System.Data.SqlClient.SNI.TdsParserStateObjectManaged.GenerateSspiClientContext(Byte[] receivedBuff, UInt32 receivedLength, Byte[]& sendBuff, UInt32& sendLength, Byte[] _sniSpnBuffer)\n
at System.Data.SqlClient.TdsParser.SNISSPIData(Byte[] receivedBuff, UInt32 receivedLength, Byte[]& sendBuff, UInt32& sendLength)\n
at System.Data.SqlClient.SqlInternalConnectionTds…ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, Boolean redirectedUserInstance, SqlConnectionS
tring userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)\n
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)\n
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)\n
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\n
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\n
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCr
eate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)\n
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)\n at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)\n
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)\n at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry, DbConnectionOptions userOptions)\n
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry)\n at System.Data.SqlClient.SqlConnection.Open()\n at Hangfire.SqlServer.SqlServerStorage.CreateAndOpenConnection()\n at Hangfire.SqlServer.SqlServerStorage.UseConnection[T](DbConnection dedicatedConnection, Func
2 func)\n
at Hangfire.SqlServer.SqlServerConnection.CreateExpiredJob(Job job, IDictionary2 parameters, DateTime createdAt, TimeSpan expireIn)\n at Hangfire.Client.CoreBackgroundJobFactory.<>c__DisplayClass14_0.<Create>b__2(Int32 _)\n at Hangfire.Client.CoreBackgroundJobFactory.RetryOnException[T](Int32& attemptsLeft, Func
2 action)
\n— End of stack trace from previous location —\n
at Hangfire.Client.CoreBackgroundJobFactory.RetryOnException[T](Int32& attemptsLeft, Func2 action)\n at Hangfire.Client.CoreBackgroundJobFactory.Create(CreateContext context)\n at Hangfire.Client.BackgroundJobFactory.<>c__DisplayClass12_0.<CreateWithFilters>b__0()\n at Hangfire.Client.BackgroundJobFactory.InvokeClientFilter(IClientFilter filter, CreatingContext preContext, Func
1 continuation)\n at Hang
fire.Client.BackgroundJobFactory.<>c__DisplayClass12_1.b__2()\n
at Hangfire.Client.BackgroundJobFactory.CreateWithFilters(CreateContext context, IEnumerable1 filters)\n at Hangfire.Client.BackgroundJobFactory.Create(CreateContext context)\n at Hangfire.BackgroundJobClient.Create(Job job, IState state)\nClientConnectionId:dd8edb40-1471-4a41-a66c-a2f748aec499\n --- End of inner exception stack trace ---\n at Hangfire.BackgroundJobClient.Create(Job job, IState state)\n at Hangfire.BackgroundJobClientExtensions.Create(IBackgroundJobClient client, Expression
1 methodCall, IState state)\n
at Hangfire.BackgroundJobClientExtensions.Schedule(IBackgroundJobClient client, Expression1 methodCall, TimeSpan delay)\n at Hangfire.BackgroundJob.Schedule(Expression
1 methodCall, TimeSpan delay)\n
at Hangfire.Server.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, IBackgroundJobClient backgroundJobClient, IRecurringJobManager recurringJobManager, IServiceProvider serviceProvider)