SQL Connection Errors in Microsoft Azure

We have an entity infrastructure implemented in our Web API 2.0 . To call database objects, we use warehouse procedure calls. Our entire application is hosted in the Microsoft Azure Cloud. Here are two exceptions we face.

Message: An error occurred while executing the command definition. See Internal Exception for more details.

InnerException: timed out. The wait period expires before the operation is completed or the server is not responding. This error occurred while trying to connect to the Princip server.

Another exception we encounter is as follows:

Message: Base provider refused Open.

InnerException: The connection was not closed. The connection status is connecting.

Note The code is in C # Web API 2.0. We use the Entity Framework to call the Store procedure. The database is in SQL Server 2012. In web.config, the connection string looks like this:

<add name="*****Entities" connectionString="metadata=res://*/Models.Database.*****.csdl|res://*/Models.Database.*****.ssdl|res://*/Models.Database.*****.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=*****;Failover Partner=*****;initial catalog=*****;user id=*****;password=********;MultipleActiveResultSets=True;Pooling=false;Connection Lifetime=2;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 

In addition, these errors are not continuous; we assume that this can occur both in network problems and in heavy traffic. But we still have no solid reason.

Please guide us with a solution for the same.

+5
source share
1 answer

For me, this seems like a Transient Fault error. You must use EF6 (or later) and configure execution strategies .

+3
source

Source: https://habr.com/ru/post/1240993/


All Articles