gpt4 book ai didi

c# - Entity Framework 架构验证失败

转载 作者:太空宇宙 更新时间:2023-11-03 10:47:19 26 4
gpt4 key购买 nike

我正在尝试为 ASP.NET MVC5 项目运行一个项目模板,该项目也使用 Owin 进行身份验证。项目构建成功,但当我尝试创建用户或执行登录或尝试启用迁移时,出现以下与 XML 模式验证相关的错误。我试图找到抛出错误的模型但找不到模型(看起来像 Owin 自动生成的模型)。目标.NET框架为4.5.1, Entity Framework 库版本为6.0.0。

System.Data.Entity.Core.MappingException: Schema specified is not valid. Errors: 
<File Unknown>(60,58) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'TypeName' attribute is invalid - The value 'ASP.NET_MVC5_with_Bootstrap_3._1._1_LESS1.Models.IdentityUserClaim_User' is invalid according to its datatype 'http://schemas.microsoft.com/ado/2009/11/mapping/cs:TQualifiedName' - The Pattern constraint failed..
at System.Data.Entity.Core.Mapping.StorageMappingItemCollection.Init(EdmItemCollection edmCollection, StoreItemCollection storeCollection, IEnumerable`1 xmlReaders, IList`1 filePaths, Boolean throwOnError)
at System.Data.Entity.Core.Mapping.StorageMappingItemCollection..ctor(EdmItemCollection edmCollection, StoreItemCollection storeCollection, IEnumerable`1 xmlReaders)
at System.Data.Entity.ModelConfiguration.Edm.DbDatabaseMappingExtensions.ToStorageMappingItemCollection(DbDatabaseMapping databaseMapping, EdmItemCollection itemCollection, StoreItemCollection storeItemCollection)
at System.Data.Entity.ModelConfiguration.Edm.DbDatabaseMappingExtensions.ToMetadataWorkspace(DbDatabaseMapping databaseMapping)
at System.Data.Entity.Internal.CodeFirstCachedMetadataWorkspace..ctor(DbDatabaseMapping databaseMapping)
at System.Data.Entity.Infrastructure.DbCompiledModel..ctor(DbModel model)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized()
at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)
at System.Data.Entity.Utilities.DbContextExtensions.<>c__DisplayClass1.<GetModel>b__0(XmlWriter w)
at System.Data.Entity.Utilities.DbContextExtensions.GetModel(Action`1 writeXml)
at System.Data.Entity.Utilities.DbContextExtensions.GetModel(DbContext context)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
at System.Data.Entity.Migrations.Design.MigrationScaffolder..ctor(DbMigrationsConfiguration migrationsConfiguration)
at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldInitialCreate(String language, String rootNamespace)
at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Schema specified is not valid. Errors:
<File Unknown>(60,58) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The 'TypeName' attribute is invalid - The value 'ASP.NET_MVC5_with_Bootstrap_3._1._1_LESS1.Models.IdentityUserClaim_User' is invalid according to its datatype 'http://schemas.microsoft.com/ado/2009/11/mapping/cs:TQualifiedName' - The Pattern constraint failed..

感谢您在此问题上的帮助。

最佳答案

我遇到了同样的问题,我在几分钟前偶然找到了解决方案。这是解决方案的名称。当我拥有 MVC5Example1.0 时,它给了我错误,但是当我将它更改为 MVC5Example1 时,它起作用了。希望它也能帮到您。

关于c# - Entity Framework 架构验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22912455/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com