R K*_*rma 5 azure code-first ef-database-first
我在我的应用程序中使用EntityFramwok(代码优先),但由于某种原因,我必须将entityframwork方法更改为数据库优先。我已经在本地成功配置了该项目,当将代码发布到微软azure服务器并尝试登录我的应用程序时,它抛出一个异常:“”The context is being used in Code First mode with code that was generated from an EDMX file for either Database First or Model First development. This will not work correctly. To fix this problem do not remove the line of code that throws this exception. If you wish to use Database First or Model First, then make sure that the Entity Framework connection string is included in the app.config or web.config of the start-up project. If you are creating your own DbConnection, then make sure that it is an EntityConnection and not some other type of DbConnection, and that you pass it to one of the base DbContext constructors that take a DbConnection. To learn more about Code First, Database First, and Model First see the Entity Framework documentation here: http://go.microsoft.com/fwlink/?LinkId=394715
我在谷歌上搜索了它,但找不到任何线索,看来我是唯一遇到此异常的人:(有人知道这一点吗。我是azure新手,所以不知道如何更改那里的实体框架方法。任何帮助或建议将不胜感激:)
在天蓝色服务器上配置网站和数据库时,您必须定义连接字符串,并且连接字符串的名称不应与 web.config 文件中的连接字符串名称相同。我刚刚在 web.config 中重命名了连接字符串名称,问题就解决了。:)
归档时间: |
|
查看次数: |
4220 次 |
最近记录: |