Sql Azure - 频繁的超时错误

时间:2014-06-05 09:30:39

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

我正在使用azure sql和许多石英窗口服务,每2分钟运行一次。我有时会得到以下错误

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和开放上下文&#34;使用&#34;块。

1 个答案:

答案 0 :(得分:1)

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