.Net 7 中初始化程序 IdentityServer4.EntityFramework.Mappers.IdentityResourceMappers 中出现错误

问题描述 投票:0回答:1

项目第一次运行时,构建初始值时出现此错误。

**System.TypeInitializationException:“‘IdentityServer4.EntityFramework.Mappers.IdentityResourceMappers’的类型初始值设定项引发了异常。”


1-VerificationException:方法 System.Linq.Enumerable.MaxFloat:类型参数“System.Char”违反了类型参数“T”的约束。**

2-ArgumentException:“T MaxFloatT”上的 GenericArguments[0]、“System.Char”违反了类型“T”的约束。*

这是我的数据:

var identityResources = new List<IdentityResource>()
               {
                    new IdentityResources.OpenId(),
                    new IdentityResource("profile","profile", new[]
                    {
                        ClaimTypes.NameIdentifier,
                        JwtClaimTypes.Role
                    }),
                };

         context.IdentityResources.AddRange(identityResources.Select(m => m.ToEntity()));

最后一行产生这两个错误。\**

我在 YouTube 上通过“ASP.NET Identity with Identity Server 4 | 教程第 1 部分”进行学习,在此视频中没有错误。

c# .net asp.net-core identityserver4
1个回答
0
投票

我找到了答案。 在 .Net 7 中存在错误

IdentityServer4.EntityFramework.Mappers.IdentityResourceMappers

IdentityServer4 应该可以解决它。

© www.soinside.com 2019 - 2024. All rights reserved.