Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 实体框架架构验证失败_C#_Asp.net_Asp.net Mvc_Entity Framework - Fatal编程技术网

C# 实体框架架构验证失败

C# 实体框架架构验证失败,c#,asp.net,asp.net-mvc,entity-framework,C#,Asp.net,Asp.net Mvc,Entity Framework,我正在尝试为ASP.NET MVC5项目运行一个项目模板,该项目还使用Owin进行身份验证。该项目构建成功,但当我尝试创建用户、执行登录或尝试启用迁移时,会出现以下与XML模式验证相关的错误。我试图找到抛出错误的模型,但找不到模型(看起来像是Owin自动生成的模型)。目标.NET framework为4.5.1,实体框架库版本为6.0.0 System.Data.Entity.Core.MappingException: Schema specified is not valid. Errors

我正在尝试为ASP.NET MVC5项目运行一个项目模板,该项目还使用Owin进行身份验证。该项目构建成功,但当我尝试创建用户、执行登录或尝试启用迁移时,会出现以下与XML模式验证相关的错误。我试图找到抛出错误的模型,但找不到模型(看起来像是Owin自动生成的模型)。目标.NET framework为4.5.1,实体框架库版本为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..
System.Data.Entity.Core.MappingException:指定的架构无效。错误:
(60,58):错误2025:映射架构的XML架构验证失败。架构错误信息:“TypeName”属性无效-值“ASP.NET\U MVC5\U with\U Bootstrap\U 3.\U 1.\U LESS1.Models.IdentityUserClaim\U User”根据其数据类型无效http://schemas.microsoft.com/ado/2009/11/mapping/cs:TQualifiedName“-模式约束失败。”。。
位于System.Data.Entity.Core.Mapping.StorageMappingItemCollection.Init(EdmItemCollection edmCollection,StoreItemCollection storeCollection,IEnumerable`1 xmlReaders,IList`1文件路径,布尔throwOnError)
位于System.Data.Entity.Core.Mapping.StorageMappingItemCollection..ctor(EdmItemCollection edmCollection、StoreItemCollection storeCollection、IEnumerable`1 xmlReaders)
位于System.Data.Entity.ModelConfiguration.Edm.DbDatabaseMappingExtensions.ToStorageMappingItemCollection(DbDatabaseMapping databaseMapping databaseMapping、EdmItemCollection itemCollection、StoreItemCollection StoreItemCollection)
位于System.Data.Entity.ModelConfiguration.Edm.DbDatabaseMappingExtensions.ToMetadataWorkspace(DbDatabaseMappingDatabaseMapping)
位于System.Data.Entity.Internal.CodeFirstCachedMetadataWorkspace..ctor(DbDatabaseMapping databaseMapping)
位于System.Data.Entity.Infrastructure.DbCompiledModel..ctor(DbModel模型)
位于System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
位于System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput输入)
在System.Data.Entity.Internal.LazyInternalContext.InitializeContext()中
在System.Data.Entity.Internal.LazyInternalContext.get_ModelBeInInitialized()中
位于System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext上下文,XmlWriter编写器)
在System.Data.Entity.Utilities.DbContextensions.c_uuuDisplayClass1.b_uuu0(XmlWriter w)中
位于System.Data.Entity.Utilities.DbContextensions.GetModel(操作'1 writeXml)
位于System.Data.Entity.Utilities.DbContextensions.GetModel(DbContext上下文)
位于System.Data.Entity.Migrations.DbMigrator..ctor(dbmigrations配置,DbContext用户上下文)
位于System.Data.Entity.Migrations.DbMigrator..ctor(dbmigrations配置)
位于System.Data.Entity.Migrations.Design.MigrationScaffolder..ctor(DbMigrationsConfiguration MigrationConfiguration)
位于System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()处
在System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)处
在System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)处
位于System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner)
位于System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldInitialCreate(字符串语言,字符串根命名空间)
在System.Data.Entity.Migrations.EnableMigrationsCommand.c__DisplayClass2.b__0()中
位于System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(操作命令)
指定的架构无效。错误:
(60,58):错误2025:映射架构的XML架构验证失败。架构错误信息:“TypeName”属性无效-值“ASP.NET\U MVC5\U with\U Bootstrap\U 3.\U 1.\U LESS1.Models.IdentityUserClaim\U User”根据其数据类型无效http://schemas.microsoft.com/ado/2009/11/mapping/cs:TQualifiedName“-模式约束失败。”。。

感谢您在这个问题上的帮助。

我也遇到了同样的问题,几分钟前我成功地找到了解决方案。 这是解决方案的名称。 当我使用MVC5Example1.0时,它给了我一个错误,但当我将它改为MVC5Example1时,它工作了。
希望它也能帮到你。

我也想插话,因为这是我发现的唯一一个与此相关的问题。上下文所在位置的名称完全限定名称。我从IdentityModels文件中的默认位置将其取出,并将其放入名为_Contexts的文件夹中。然后我犯了这个错误


我将文件夹重命名为Contexts,错误消失了。所以可能是特殊的字符,比如句号。上面的海报也是如此。FQN中的下划线似乎是问题的原因。

感谢您提供答案。事实上,在另一台机器上,我用不同的名称创建了同一个项目,它工作了,但我无法将问题与名称联系起来。谢谢