【问题标题】:Sql Azure - Frequent timeout errorSql Azure - 频繁的超时错误
【发布时间】:2014-06-05 09:30:39
【问题描述】:

我正在使用带有许多每 2 分钟运行一次的石英 Windows 服务的 azure sql。我有时会出现以下错误

Message:An error occurred while executing the command definition. See the inner 
 exception for details.|System.Data.SqlClient.SqlException (0x80131904): A 
 transport-level error has occurred when receiving results from the server. 
 (provider: Session Provider, error: 19 - Physical connection is not usable) 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.TdsParserStateObject.ReadSniError(TdsParserStateObject 
 stateObj, UInt32 error) at 
 System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync() at 
 System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket() at 
 System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer() at 
 System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte& value) 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.<>c__DisplayClass
 b.b__8() at 
 System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TInterc
 eptionContext,TResult](Func`1 operation, TInterceptionContext interceptionContext, 
 Action`1 executing, Action`1 executed) at 
 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand 
 command, DbCommandInterceptionContext interceptionContext) at 
 System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavi
 or behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior 
 behavior) at 
 System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCo
 mmands(EntityCommand entityCommand, CommandBehavior behavior) 
 ClientConnectionId:9a85a9a9-69aa-4a68-8e05-e54adf5ac318

任何想法如何解决这个问题?我们正在使用 EF 6.1 并在“使用”块中打开上下文。

【问题讨论】:

标签: azure timeout azure-sql-database connection-timeout


【解决方案1】:

找到答案here。在使用 Azure SQL 时,我们应该有逻辑来重试数据库操作。 EF 6.0 开箱即用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-09
    • 1970-01-01
    • 2013-08-08
    • 1970-01-01
    • 2018-08-29
    • 1970-01-01
    • 2021-10-08
    • 2021-01-12
    相关资源
    最近更新 更多