I\'ve created an MVC 4 application using entity framework to read and write data to a database I am hosting on an Azure database. The Azure database was supposed to keep th
I have tried to reproduce your issue according with below steps:
1) create Asp.net MVC template, then register a new user.
Result: We could find user info on local database.
2) Add controller with views using Entity Framework. And use Azure SQL database as its resource.
Result: we will find two connection in our web.config
3) Delete default connection string
4) Change Application DB Context connection string
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext()
: base("jambdbEntities", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
After above steps, My application give me below error:
Solution:
1) Edit 'DefaultConnection' connection string
2) Modify the code:
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext()
: base("jambdbEntitiesapplication", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
3) Modify AutomaticMigrationsEnabled = true;
in Configuration class under Migrations folder.
Here is the result: