“The ConnectionString property has not been initialized.” - but only when publishing

梦想的初衷 提交于 2019-12-06 04:17:11

For anyone else who runs into this problem - I found my solution.

I had just upgraded ASP Identity to version 2.0.0 via Nuget, and when it installed the Microsoft.AspNet.Identity.EntityFramework package it changed my publish settings and seperated the AppliationDbContext and the DefaultConnectionString and this is what caused the problem.

What I had to do was literally as easy as to change the following to my ApplicationDbContext

ASP Identity 1.0.0

public ApplicationDbContext() : base("DefaultConnection")
{

}

ASP Identity 2.0.0

// Set the throwIfV1Schema to false...
public ApplicationDbContext() : base("DefaultConnection", throwIfV1Schema: false)
{

}

I have no idea why this didn't affect my local development version, but it's solved my issue. Hope this helps someone!

I just unclick "execute code first migration" it worked.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!