我在尝试设置OWIN身份并安装了实体 Framework 6.1.2 库时遇到了问题,并且我使用mysql作为后端。但是,当我运行应用程序并尝试将其作为例如注册用户时,我收到以下错误:
System.TypeLoadException:无法加载类型 'System.ComponentModel.DataAnnotations.Schema.IndexAttribute'来自 assembly'EntityFramework,Version = 6.0.0.0,Culture = neutral, 公钥= b77a5c561934e089' 。在 Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext
6.OnModelCreating(DbModelBuilder modelBuilder) at System.Data.Entity.Internal.LazyInternalContext.CreateModelBuilder() at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) at System.Data.Entity.Internal.RetryLazy
2.GetValue(TInput input)at at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(类型 entityType)at System.Data.Entity.Internal.Linq.InternalSet1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet
1.Include(String path)at System.Data.Entity.Infrastructure.DbQuery1.Include(String path) at System.Data.Entity.QueryableExtensions.Include[T](IQueryable
1个来源, 字符串路径) System.Data.Entity.QueryableExtensions.Include [T,TProperty](IQueryable1 source, Expression
1路径)at at Microsoft.AspNet.Identity.EntityFramework.UserStore6.GetUserAggregateAsync(Expression
1 过滤器) Microsoft.AspNet.Identity.EntityFramework.UserStore6.FindByNameAsync(String userName) at Microsoft.AspNet.Identity.UserManager
2.FindByNameAsync(字符串 user.)at Microsoft.AspNet.Identity.UserValidator2.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNet.Identity.UserValidator
2.d__0.MoveNext()--- 从抛出异常的先前位置开始的堆栈跟踪结束 ---在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在Microsoft.AspNet.Identity.UserManager2.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNet.Identity.UserManager
2.d__d.MoveNext()--- 从抛出异常的先前位置开始的堆栈跟踪结束 ---在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在Microsoft.AspNet.Identity.AsyncHelper.RunSync [TResult](Func1 func) at Microsoft.AspNet.Identity.UserManagerExtensions.Create[TUser,TKey](UserManager
2 经理,TUser用户,字符串密码)at Account_register.btnRegister_Click(Object sender,EventArgs e)in c:\ Users \ ashish \ Documents \ Visual Studio 2012 \ WebSites \ online \ Account \ register.aspx.cs:第37行
答案 0 :(得分:0)
我不确定这是否与您的问题有关,但我的MySql OWIN Identity项目在EF 6.1.2下失败。我退回到6.1.1,它工作正常。
当我使用EF 6.1.2时,我已经完成并运行了项目,所以我注意到我的单元测试中的问题已经开始吐出。
System.Data.Entity.Core.EntityCommandExecutionException:错误 执行命令定义时发生。看到内心 细节例外。 --->
MySql.Data.MySqlClient.MySqlException:SQL中有错误 句法;查看与MySQL服务器版本对应的手册 正确的语法使用近' FROM((SELECT CASE WHEN (
Extent2
。UserId
IS NULL)THEN(NULL)ELSE(1)END'第29行。