已存在数据库中的命名为“应用程序”的对象 [英] There is already an object named 'Applications' in the database
问题描述
我在asp.net的WebAPI的服务得到了这个错误,当我调用方法 Membership.ValidateUser(电子邮件,密码);
。
我使用EF 4.3.1。 DB使用该code创建
I got this error in my asp.net webapi service when I call method Membership.ValidateUser(email, password);
.
I am using EF 4.3.1. DB created using this code
using (var db = DbFactory.Get())
{
Console.WriteLine("Creating new database...");
db.Database.Create();
Console.WriteLine("Initializing with initial objects...");
db.Database.Initialize(true);
}
我得到这个错误只有一次我服务的第一次启动。
是否有人知道为什么会发生?
I get this error only once on first start of my service. Does anybody know why it happens?
推荐答案
这听起来像你已经有一个对象在数据库中的首次应用程序启动一个名为应用程序。结果
请问code片段您提供,仅在启动时运行?结果
尝试通过数据库管理引擎丢弃对象,然后重新运行您服务。
It sounds like you already have an object named 'Applications' in the database the first time your application starts.
Does the code snippet you provided only run at startup?
Try dropping the object through the database management engine, and then re-running your service.
这篇关于已存在数据库中的命名为“应用程序”的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!