NuGet update, now throwing OpenTok: System.IO.FileLoadException: Could not load file or assembly JWT Version=2.0.0.0 on CreateSession

1

I just updated all my NuGet packages and I can no longer connect to a session. I'm running OpenTok 3.1.0 and JWT 6.1.0 but getting the following error on 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.

It appears that I might have a JWT versioning problem since it references 2.0.0.0 in the error message while I have 6.1.0 installed and in packages.config. However, I don't know why it would show 2.0.0.0 or how to fix that.

c#
jwt
opentok
asked on Stack Overflow Mar 1, 2020 by Velocedge

1 Answer

0

jdweng's comments led directly to the answer. OpenTok doesn't work with 6.1.0, uninstalling fixed the issue. Have since posted an issue with TokBox to find out why it doesn't work.

answered on Stack Overflow Mar 1, 2020 by Velocedge

User contributions licensed under CC BY-SA 3.0