I have an MVC5 / EF6.1 website that runs perfectly on my development machine using LocalDb.
However, when I publish this to an Azure Website with an Azure SQL Database, I get the following error when doing any database interaction:
The ConnectionString property has not been initialized.
I've searched all over and can't find the reason that this happens on Azure.
The first file the stack trace points to is IdentityModels.cs:45
That contains the following:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext() : base("DefaultConnection")
{
}
}
When I publish to Azure I've tested the connection string (comes back OK), and this is the Settings screen:
Any idea as to what is going on?
UPDATE:
If don't select ApplicationDbContext
and instead select DefaultConnection
it works, however I won't be able to use code first migrations. How can I get the ApplicationDBContext
to work again?