2014-06-05 1 views
3

나는 2 분 간격으로 실행되는 많은 석영 windows 서비스와 함께 azure sql을 사용하고 있습니다. 때때로 다음과 같은 오류가 발생합니다.Sql Azure - 자주 발생하는 시간 초과 오류

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 및 열린 컨텍스트를 사용하고 있습니다.

+0

일시적인 오류가 발생할 가능성이 가장 높음 http://www.asp.net/aspnet/overview/developing-apps-with-windows-azure/building-real-world-cloud-apps- with-windows-azure/transient-fault-handling – pateketu

+0

참조 http://stackoverflow.com/questions/23290720/azure-website-sometimes-cant-connect-to-sql-azure-database/23295389#23295389 – CSharpRocks

답변

1

대답은 here입니다. Azure SQL을 사용하면서 데이터베이스 작업을 다시 시도하는 로직이 있어야합니다. EF 6.0에서 즉시 제공합니다.