c# - NuGet 更新,现在抛出 OpenTok: System.IO.FileLoadException: Could not load file or assembly JWT Version=2.0.0.0 on CreateSession
问题描述
我刚刚更新了我所有的 NuGet 包,我无法再连接到会话。我正在运行 OpenTok 3.1.0 和 JWT 6.1.0,但在 OpenTok.ConnectSession 上出现以下错误:
OpenTok = new OpenTok(apiKey, apiSecret);
SessionHost = OpenTok.CreateSession(mediaMode: MediaMode.ROUTED); <-- error here
3/1/2020 7:40:08 AM ERROR:
OpenTok: System.IO.FileLoadException: Could not load file or assembly 'JWT, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'JWT, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'
at OpenTokSDK.Util.HttpClient.GenerateJwt(Int32 key, String secret, Int32 expiryPeriod)
at OpenTokSDK.Util.HttpClient.GetCommonHeaders()
at OpenTokSDK.Util.HttpClient.GetRequestHeaders(Dictionary`2 headers)
at OpenTokSDK.Util.HttpClient.DoRequest(String url, Dictionary`2 specificHeaders, Dictionary`2 bodyData)
at OpenTokSDK.OpenTok.CreateSession(String location, MediaMode mediaMode, ArchiveMode archiveMode)
at eTutorServer.eTutorService.userIdentification(Int32 handle, String strData, String[] sAry) in D:\Data\CADE.Net\eTutorServer\eTutorServer\eTutorService.cs:line 1514
=== Pre-bind state information ===
LOG: DisplayName = JWT, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///D:/Data/CADE.Net/eTutorServer/eTutorServer/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : OpenTok, Version=3.1.6873.25151, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Data\CADE.Net\eTutorServer\eTutorServer\bin\Debug\eTutorServer.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///D:/Data/CADE.Net/eTutorServer/eTutorServer/bin/Debug/JWT.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
看来我可能有 JWT 版本控制问题,因为它在我安装了 6.1.0 和 packages.config 时在错误消息中引用了 2.0.0.0。但是,我不知道为什么它会显示 2.0.0.0 或如何解决这个问题。
解决方案
jdweng 的评论直接引出了答案。OpenTok 不适用于 6.1.0,卸载解决了这个问题。从那以后发布了一个关于 TokBox 的问题,以找出它为什么不起作用。
推荐阅读
- javascript - 如果我想在 PHP 中编辑行,请更新查询插入
- php - 如何在 PHP 中将最后所需的天数转换为周数
- arduino - 磁力计偏差问题
- .net - 将 eterogeneus xml 文件反序列化为 vb.net 中的对象字典
- jquery - JQuery 窗口打印功能问题
- regex - 使用内容分隔符作为文件名在 PowerShell 中拆分文本
- amazon-web-services - 将 godaddy 域添加到 AWS Elastic Beanstalk 站点?
- reactjs - 为父母的孩子重新渲染逻辑,每秒更新多次
- java - 如何不调用(spy)静态成员的方法(KafkaTemplate UT)
- css - 离子长按与点击事件冲突