[英]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.