6
votes

Every time I swap my deployments between Staging and Production, I got this kind of error :

[Wed Oct 09 18:43:51.9519 +00:00 2013] [Error] [Zappiti.BaseApi] An error occurred while updating the entries. See the inner exception for details.

System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: 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.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.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)

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.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)

at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator, EntityConnection connection, Dictionary2 identifierValues, List1 generatedValues)

at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)

--- End of inner exception stack trace ---

at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)

at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)

at System.Data.Entity.Internal.InternalContext.SaveChanges()

--- End of inner exception stack trace ---

at System.Data.Entity.Internal.InternalContext.SaveChanges()

at Zappiti.BaseApi.PutVideo(PutVideo putVideo, Guid userId, String queueName, Boolean isBeta)

I deploy my package using a standard Build Definition from TFS.

Is there a way to avoid these connection errors ?

1
I get the same error, did you have any luck with this?hermiod
Me too - it's annoying. Any insight?SB2055
So far, I use a try/catch to retry SaveChanges() that failed. I retry x times, with a sleep beteween each try. Not perfect, but it solve 90% of errors.Filimindji

1 Answers

0
votes

I just found this feature in the changelog of EF 6.x :

http://msdn.microsoft.com/en-us/data/dn456835

I'll take a try.

Stay tuned.