Je viens de publier un site Web Azure à l'aide d'un SQL Azure.
Cependant, j'ai l'erreur
An existing connection was forcibly closed by the remote host
lorsque vous atteignez le site Web, avec le callback lié à Hangfire:
[Win32Exception (0x80004005): An existing connection was forcibly closed by the remote host] [SqlException (0x80131904): A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)] System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionSsortingng connectionOptions, SqlCredential credential, Object providerInfo, Ssortingng newPassword, SecureSsortingng newSecurePassword, Boolean redirectedUserInstance, SqlConnectionSsortingng userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, Ssortingng accessToken, Boolean applyTransientFaultHandling) +830 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +329 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) +38 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +507 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +154 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +21 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +90 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +217 System.Data.SqlClient.SqlConnection.Open() +96 Hangfire.SqlServer.SqlServerStorage.CreateAndOpenConnection() +49 Hangfire.SqlServer.SqlServerStorage.UseConnection(Func`2 func) +41 Hangfire.SqlServer.SqlServerStorage.UseTransaction(Func`2 func, Nullable`1 isolationLevel) +84 Hangfire.SqlServer.SqlServerStorage.UseTransaction(Action`1 action) +73 Hangfire.SqlServer.SqlServerWriteOnlyTransaction.Commit() +47 Hangfire.RecurringJobManager.AddOrUpdate(Ssortingng recurringJobId, Job job, Ssortingng cronExpression, TimeZoneInfo timeZone, Ssortingng queue) +277
de[Win32Exception (0x80004005): An existing connection was forcibly closed by the remote host] [SqlException (0x80131904): A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)] System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionSsortingng connectionOptions, SqlCredential credential, Object providerInfo, Ssortingng newPassword, SecureSsortingng newSecurePassword, Boolean redirectedUserInstance, SqlConnectionSsortingng userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, Ssortingng accessToken, Boolean applyTransientFaultHandling) +830 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +329 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) +38 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +507 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +154 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +21 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +90 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +217 System.Data.SqlClient.SqlConnection.Open() +96 Hangfire.SqlServer.SqlServerStorage.CreateAndOpenConnection() +49 Hangfire.SqlServer.SqlServerStorage.UseConnection(Func`2 func) +41 Hangfire.SqlServer.SqlServerStorage.UseTransaction(Func`2 func, Nullable`1 isolationLevel) +84 Hangfire.SqlServer.SqlServerStorage.UseTransaction(Action`1 action) +73 Hangfire.SqlServer.SqlServerWriteOnlyTransaction.Commit() +47 Hangfire.RecurringJobManager.AddOrUpdate(Ssortingng recurringJobId, Job job, Ssortingng cronExpression, TimeZoneInfo timeZone, Ssortingng queue) +277
Une idée?
J'ai eu exactement le même problème. Si vous, comme moi, avez copié la string de connection à partir de la page des parameters de database Azure Portal, essayez de supprimer Pooling=False;
. Cela a réglé le problème pour moi.
Désolé, je n'ai pas une bonne explication de pourquoi cela a causé l'échec de Hangfire. Mais normalement, vous voudriez avoir le pool de connection activé de toute façon.