我刚刚将我的网站部署到azure,我立刻收到了这个错误。我尝试阅读其他一些关于同一问题的帖子,但我找不到修复方法。以下是我进行部署的过程:
Data Source = tcp:eaduy2evm7.database.windows.net,1433; Initial Catalog = TandForumTestVersion_db; User Id = tandforum_test @ eaduy2evm7; Password = ********
抛出此异常:
[InvalidOperationException: The ConnectionString property has not been initialized.]
这是我在Webconfig文件中的连接字符串:
<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" />
上下文类:
public class AppIdentityDbContext : IdentityDbContext<AppUser>
{
public AppIdentityDbContext() : base("IdentityDb")
{
}
}
迁移文件夹中的配置类:
internal sealed class Configuration : DbMigrationsConfiguration<TandForum.dk.Data_Acces_Layer.AppIdentityDbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
ContextKey = "TandForum.dk.Data_Acces_Layer.AppIdentityDbContext";
}
}
我真的很感激任何帮助