Full exception:
System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for de
My problem was with the time of SqlAzureExecutionStrategy
, was stablished in 300 secods (5 minutes) and the operations I was doing took more than 5 minutes:
Imports System.Data.Entity
Imports System.Data.Entity.SqlServer
Namespace Models
Public Class ModelConfiguration
Inherits DbConfiguration
Sub New()
' https://docs.microsoft.com/es-es/ef/ef6/fundamentals/connection-resiliency/retry-logic
' WebConfig
Dim AzureBBDD = ConfigurationManager.AppSettings("AzureBBDD").Equals("SI")
' If AzureBBDD == "SI"
If (AzureBBDD) Then
' WebConfig, here was the problem, low value in seconds...
Dim AzureBBDDMaxTimeSeconds = Integer.Parse(ConfigurationManager.AppSettings("AzureBBDDMaxTimeSeconds"))
SetExecutionStrategy("System.Data.SqlClient",
Function()
Return New SqlAzureExecutionStrategy(Integer.MaxValue, TimeSpan.FromSeconds(AzureBBDDMaxTimeSeconds))
End Function)
End If
End Sub
End Class
End Namespace