当我发布我的网站时,我的服务器上不断收到此错误 - 即使没有更改数据库模型。
该网站在本地运行良好。
我正在使用数据库优先方法。
如果我删除服务器上站点中的所有文件,请在服务器上恢复我的本地数据库。从 VS 发布网站。有时它会在那之后运行良好。
如果我随后在数据库内容中进行一些更改,我将收到错误消息。
我不想在服务器上创建任何数据库/表 - 只需禁用需要执行的代码部分。在 MVC3 中,我们有这个 DropCreateDatabaseIfModelChanges 但我在当前站点中看不到任何内容。
我能做些什么?
我的连接字符串:
<connectionStrings>
<add name="GoBagHomeComEntities" connectionString="metadata=res://*/Models.GoBagHomeModel.csdl|res://*/Models.GoBagHomeModel.ssdl|res://*/Models.GoBagHomeModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\sqlexpress;initial catalog=GoBagHomeCom;Persist Security Info=True;User ID=xx;Password=xxxx;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
还有我的 dbcontext
public partial class GoBagHomeComEntities : DbContext
{
public GoBagHomeComEntities()
: base("name=GoBagHomeComEntities")
{
}