I have a worker role that connects to Sql Azure retrieves a record at a time, processes it marks it done using Entity Framework 4. Pseudo code
while (true)
{
ProcessRecord();
}
ProcessRecord()
{
try{
ObjectContext oc = new ObjectContext ();
//process records
oc.Dispose()
}
catch(Exception e)
{
//logging code goes here...
}
}
The role runs just fine but occasionally (say 9 hrs once) I get an error – “The underlying provider failed on Open.” Does that mean that the worker role is unable to connect to SQL Server?
Do you log the exact error code? In general there are a lot of things that could be. As a start I suggest to read this article, explaining a lot of them. Also check out this SO question, as my answer there explains a lot about Windows Azure SQL Database.