c# - 使用 Azure 的 '/' 应用程序中的服务器错误

标签 c# asp.net azure database-migration

问题是使用其他计算机迁移后网页未部署,并且迁移文件被删除。

错误是

The model backing the 'ProjectContext' context has changed since the database was created. Consider using Code First Migrations to update the database

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The model backing the 'ProjectContext' context has changed since the database was created. Consider using Code First Migrations to update the database

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

有什么办法可以解决我的电脑上的这个问题吗?或者这背后还有另一个问题?

最佳答案

该消息表示您的数据库模型与 Entity Framework “代码优先”模型/代码不同步。

要解决此问题,您可以使用 Code First Migrations 。 MSDN 上的链接教程解释了您应该做什么。您实际上必须使用包控制台和一些 C# 代码将一个版本迁移到另一个版本。这是您在项目编码时必须做的事情。如果您发布它,代码可以自动更新您的数据库模型以匹配您的 Entity Framework Code First 代码。

关于c# - 使用 Azure 的 '/' 应用程序中的服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34628908/

相关文章:

C#解码(解压缩)PDF文件的压缩数据

c# - 构建全新系统时应该采用什么方法/设计路径?

azure - 如何以与云无关的方式使用 Terraform

sql - 从字符串转换日期和/或时间时转换失败

c# - 防止 Asp Net Core 3 应用程序被停止/卸载/处置

azure - 在 terraform 代码中使用多个版本的 azurerm

c# - Azure 驱动器、 block Blob 与表

c# - 是否可以查询WebBrowser控件水平滚动条是否可见?

c# - 来自类结构的类使用细节

c# - WPF MVVM Bind Dictionary<String, List<String>> 到数据网格