5

We have entity framework implemented in our Web API 2.0 code. To call database entities, we are using store procedure calls. Our entire application is hosted in Microsoft Azure cloud. Here are the two exception which we are facing.

Message : An error occurred while executing the command definition. See the inner exception for details.

InnerException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. This failure occured while attempting to connect to the Principle server.

One more exception we are facing is like:

Message : The underlying provider failed on Open.

InnerException: The connection was not closed. The connection's current state is connecting.

Note: Code is in C# Web API 2.0. We are using Entity Framework to call Store Procedure. Database is in SQL Server 2012. In web.config, the connection string looks like below:

  <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" />

Also, this errors are not continuous, we guess this might be happening either network issues or while heavy traffic. But we are still not having any firm cause about this.

Please guide us with a solution for the same.

1 Answer 1

3

This looks like Transient Fault error to me. You should use EF6 (or later) and setup the Execution Strategies.

Sign up to request clarification or add additional context in comments.

4 Comments

What does it mean by Transient Fault error? Btw am using EF version 5.0.0.0 in my project.
When cloud-based applications use other cloud-based services, errors can occur because of temporary conditions such as intermittent service, infrastructure-level faults, or network issues. Very often, if you retry the operation a short time later (maybe only a few milliseconds later) the operation may succeed. These types of error conditions are referred to as transient faults.
Thanks for the information @Sascha. So how to handle or deal with this type of errors? Is there any documentation or coding/architectural guidelines available? Everyone who has setup Azure - are facing such errors ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.