简体   繁体   English

在基于 .Net 4.6 的 Web Api 2 中使用 System.IdentityModel.Tokens.Jwt 5.0.0.127 的异常

[英]Exception using System.IdentityModel.Tokens.Jwt 5.0.0.127 in Web Api 2 built on .Net 4.6

I have updated my existing Web Api project to use the latest System.IdenityModel.Tokens.Jwt package and I am getting the following error:我已更新我现有的 Web Api 项目以使用最新的 System.IdenityModel.Tokens.Jwt 包,但出现以下错误:

Could not load type 'System.IdentityModel.Tokens.TokenValidationParameters' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.无法从程序集“System.IdentityModel.Tokens.Jwt,版本=5.0.0.127,Culture=neutral,PublicKeyToken=31bf3856ad364e35”加载类型“System.IdentityModel.Tokens.TokenValidationParameters”。

Everything works fine with 4.0 version of the same package.使用相同软件包的 4.0 版本一切正常。 How can I resolve this?我该如何解决这个问题?

If you want to use the new version(v5) of System.IdentityModel.Tokens.Jwt and don't want to restrict your project to the v4 version, I have created a Nuget and Github project called EasyJwtAuth that uses v5(Very simple to use):如果您想使用 System.IdentityModel.Tokens.Jwt 的新版本(v5)并且不想将您的项目限制为 v4 版本,我创建了一个名为 EasyJwtAuth 的 Nuget 和 Github 项目,它使用 v5(非常简单使用):

Nuget package: https://www.nuget.org/packages/EasyJwtAuth Nuget 包: https ://www.nuget.org/packages/EasyJwtAuth

Instructions on how to use: https://github.com/Xela101/EasyJwtAuth使用说明: https : //github.com/Xela101/EasyJwtAuth

Feel free to update the repository with more features, or just learn/copy the code and make your own authentication wrapper.随意使用更多功能更新存储库,或者只是学习/复制代码并制作自己的身份验证包装器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用System.IdentityModel.Tokens.Jwt在Web API中进行JWT身份验证 - JWT Authentication in Web API using System.IdentityModel.Tokens.Jwt 使用ASP.NET 5中的System.IdentityModel.Tokens.Jwt编码JWT令牌 - Encoding JWT Token Using System.IdentityModel.Tokens.Jwt in ASP.NET 5 使用Microsoft System.IdentityModel.Tokens.Jwt在Asp.net WebApi中实现JWT身份验证 - Implementing JWT authentication in Asp.net WebApi using Microsoft System.IdentityModel.Tokens.Jwt 使用System.IdentityModel.Tokens.Jwt与RS512验证JWT签名 - Validate JWT signature with RS512 using System.IdentityModel.Tokens.Jwt 无法读取使用 System.IdentityModel.Tokens.Jwt 生成的 JWT 令牌 - Unable to read JWT token generated using System.IdentityModel.Tokens.Jwt 使用 System.IdentityModel.Tokens.Jwt 验证没有密钥 Id 的外部创建的 JWT - Validate an externally created JWT with no key Id using System.IdentityModel.Tokens.Jwt 在System.IdentityModel.Tokens.Jwt中键入加载错误 - Type Load error in System.IdentityModel.Tokens.Jwt 如何为 JwtBearer 和 System.IdentityModel.Tokens.Jwt 在 asp.net 内核中自定义承载 header 关键字? - How to customize bearer header keyword in asp.net core for JwtBearer and System.IdentityModel.Tokens.Jwt? 使用 System.IdentityModel.Tokens.Jwt 验证在 C# 中生成的令牌 - Verify Token generated in C# with System.IdentityModel.Tokens.Jwt System.Identitymodel.Tokens.jwt 没有发行人可能吗? - System.Identitymodel.Tokens.jwt without issuer possible?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM