I did everything that I read on the Internet, textbooks, but nothing works!
https://www.google.com/search?q=reliablesqlconnection+azure
http://geekswithblogs.net/ScottKlein/archive/2012/01/27/understanding-sql-azure-throttling-and-implementing-retry-logic.aspx
I already set all hands in the lab:
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=6932
Nuget
PM> Install-Package EnterpriseLibrary.WindowsAzure.TransientFaultHandling
PM> Install-Package CommonServiceLocator
All the configuration I found to solve specific problems (just mention this).
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="RetryPolicyConfiguration" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.Configuration.RetryPolicyConfigurationSettings, ... />
<section name="typeRegistrationProvidersConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.TypeRegistrationProvidersConfigurationSection, Microsoft.Practices.EnterpriseLibrary.Common... />
</configSections>
<RetryPolicyConfiguration defaultRetryStrategy="Fixed Interval Retry Strategy">
<incremental name="Incremental Retry Strategy" />
<fixedInterval name="Fixed Interval Retry Strategy" />
<exponentialBackoff name="Exponential Backoff Retry Strategy" />
</RetryPolicyConfiguration>
<typeRegistrationProvidersConfiguration>
<add sectionName="RetryPolicyConfiguration" name="RetryPolicyConfiguration" />
</typeRegistrationProvidersConfiguration>
</configuration>
I can not make it work! I keep getting errors like
Could not load file or assembly 'Microsoft.Practices.ServiceLocation,
OR
The type RetryManager cannot be constructed. You must configure the container to supply this value
OR
Activation error occured while trying to get instance of type RetryManager, key "
OR it searches for * .cs files when debugging!
And more and more !!
Someone out there! with simple azure reliable SqlConnection sampling! what can i download and run? You are welcome! Prefer to use the latest dll?
Thank.
WinForm
!
ReliableSqlconnection with ExecuteReader or
SqlConnection with ExecuteReaderWithRetry or
ReliableSqlconnection with ExecuteReaderWithRetry
! SqlConnection ExecuteReader, .! ! .
using (var cnn = new ReliableSqlConnection(connString))
{
cnn.Open();
using (var cmd = cnn.CreateCommand())
{
cmd.CommandText = "SELECT * FROM MyTable";
using (var rdr = cmd.ExecuteReaderWithRetry())
{
if (rdr.Read())
{
Console.Write(rdr.GetString(1));
}
}
}
}