英文:
TypeLoadException exception on signout after upgrading to aspnet core 3.1
问题
我使用IdentityServer4进行身份验证,它与Asp.net Core Web项目一起安装在Visual Studio 2019中。升级到asp.net 3.1后,我在SignOut时遇到以下错误。我尝试强制更新所有Nugets到最新版本,但仍然无法使其工作。感谢任何解决方法。
TypeLoadException: 无法从程序集IdentityServer4, Version=3.1.0.0, Culture=neutral, PublicKeyToken=f294d0afe402bb2b中加载类型'Microsoft.AspNetCore.Http.IReadableStringCollectionExtensions'。
Microsoft.AspNetCore.ApiAuthorization.IdentityServer.AutoRedirectEndSessionEndpoint.GetParametersAsync(HttpRequest request)
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<TStateMachine>(ref TStateMachine stateMachine)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>.Start<TStateMachine>(ref TStateMachine stateMachine)
Microsoft.AspNetCore.ApiAuthorization.IdentityServer.AutoRedirectEndSessionEndpoint.GetParametersAsync(HttpRequest request)
Microsoft.AspNetCore.ApiAuthorization.IdentityServer.AutoRedirectEndSessionEndpoint.ProcessAsync(HttpContext ctx)
IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
英文:
I use IdentityServer4 for auth which gets installed with Asp.net core web project in visual studio 2019. After upgrading to asp.net 3.1, I get below error on SignOut. I tried force update all the Nugets to latest. Still, I couldn't make it work. Appreciate any workaround.
TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.IReadableStringCollectionExtensions' from assembly 'IdentityServer4, Version=3.1.0.0, Culture=neutral, PublicKeyToken=f294d0afe402bb2b'.
Microsoft.AspNetCore.ApiAuthorization.IdentityServer.AutoRedirectEndSessionEndpoint.GetParametersAsync(HttpRequest request)
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<TStateMachine>(ref TStateMachine stateMachine)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>.Start<TStateMachine>(ref TStateMachine stateMachine)
Microsoft.AspNetCore.ApiAuthorization.IdentityServer.AutoRedirectEndSessionEndpoint.GetParametersAsync(HttpRequest request)
Microsoft.AspNetCore.ApiAuthorization.IdentityServer.AutoRedirectEndSessionEndpoint.ProcessAsync(HttpContext ctx)
IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
答案1
得分: 1
我通过将IdentityServer4.EntityFramework的引用版本从3.1.0恢复到3.0.2来解决了这个问题,似乎在3.1.0中还没有实现缺失的类型。
我花了几天时间为工作研究这个问题,但未能找到任何官方文档与该问题或缺失类型有关。因此,解决方案更多是出于沮丧而非其他原因。对于为什么需要回退版本,我无法提供充分的理由,只是通过这样做我解决了问题。
英文:
I fixed this by reverting the IdentityServer4.EntityFramework reference from version 3.1.0 to 3.0.2, it would seem that the missing type is not yet implemented in 3.1.0.
I spent a few days researching this for work and I was unable to find any official documentation with regards to the problem or to the missing type. So the solution came from exasperation more than anything else. I apologize that I cannot provide you with adequate reasoning as to why it needs to be reverted, just that by doing it I fixed it.
答案2
得分: 0
我有DAL有IdentityServer4.EntityFramework和IdentityServer4,还有ClientSlide层有IdentityServer4包。将它们全部更改为3.0.2而不是3.1.0可以解决问题。
英文:
for me
I have DAL has
IdentityServer4.EntityFramework and IdentityServer4
also the layer of ClientSlide has IdentityServer4 package changes all them to 3.0.2 instead of 3.1.0 solves the issue
答案3
得分: 0
问题已解决,通过卸载 Nuget 包 IdentityServer4
版本 3.1.1,并让框架使用内置版本 3.0.0。
英文:
For me the problem was resolved by uninstalling the Nuget package IdentityServer4
version 3.1.1 and letting the framework use the builtin one with version 3.0.0.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论