I just deployed my website to azure and i got this error instantly. I tried reading some other posts about the same problem, but i couldn't find a fix. Here is the process i went through to deploy:
- Clicked publish in visual studio
- Under "select publish target" i chose microsoft azure websites
- Created the web app and sql database
- Under settings -> databases, it said AppIdentityDbContext(IdentityDb) and showed me this string:
Data Source=tcp:eaduy2evm7.database.windows.net,1433;Initial Catalog=TandForumTestVersion_db;User Id=tandforum_test@eaduy2evm7;Password=********
- I checked "use this connection string at runetime" and "execute code first migrations" options
- Clicked publish
This exception thrown:
[InvalidOperationException: The ConnectionString property has not been initialized.]
Here is my connection string in the Webconfig file:
<add name="IdentityDb" providerName="System.Data.SqlClient" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=IdentityDb;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False; MultipleActiveResultSets=True" />
Context class:
public class AppIdentityDbContext : IdentityDbContext<AppUser>
{
public AppIdentityDbContext() : base("IdentityDb")
{
}
}
Configuration class in Migrations folder:
internal sealed class Configuration : DbMigrationsConfiguration<TandForum.dk.Data_Acces_Layer.AppIdentityDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
ContextKey = "TandForum.dk.Data_Acces_Layer.AppIdentityDbContext";
}
}
I would really appreciate any help