Could not load file or assembly 'System.IdentityModel.Tokens.Jwt after deploying on Azure

9

my web app is working fine on localhost, but when I publish it on Azure, I get the following error:

Could not load file or assembly 'System.IdentityModel.Tokens.Jwt' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

On a localhost is working fine.

I am using 4.5 framework, and it is definned in web.config file too. I tried to reinstall it in nuget manager but I get

Package 'System.IdentityModel.Tokens.Jwt.4.0.2.206221351' already exists in project 'project1'

I also can't find this assembly in references folder. This is the first time I have expirienced this type of a problem.

What do you recommend me to do?

Regards, Sandi

asp.net-mvc
azure
web-deployment
asked on Stack Overflow Apr 18, 2016 by Sandi Horvat

5 Answers

9

I have figured it out. I updated System.IdentityModel.Tokens.Jwt reference via nuget package manager and it works again.

Regards!

answered on Stack Overflow Apr 18, 2016 by Sandi Horvat
8

There is a known issue in Azure Functions host: https://github.com/Azure/azure-functions-host/issues/5894

The current workaround is to add the following to your .csproj:

<PropertyGroup>
  <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
answered on Stack Overflow Feb 8, 2021 by Marek Stój
0

I had the same problem. I solved it by selecting 'Refresh dependencies' of the Detected Dependencies in my Install Project. I think its a bug, as the System.IdentityModel.Tokens.Jwt assembly resided in the program files target folder, and had a compliant versioning. If you're not working with VS, perhaps you could can relate this to your own development environment.

answered on Stack Overflow Mar 27, 2019 by Dutchpaddy
0

it is easy to resolve. just go to the web config and find the package in which you are getting the error. and check the version mentioned in the web.config. and compare it to the NuGet package from the reference which is already installed in the project. and make it similar in both.

Nuget Package version

In my case, I have installed the 3.10.10.0 and in web config, it shows me different. I have changed it to 3.10.10.0. and everything works fine.

web.config version

answered on Stack Overflow Jun 15, 2020 by jeet
-1

I had to roll back the dot net framework to 4.5.1

answered on Stack Overflow Jul 7, 2017 by Kirsten Greed

User contributions licensed under CC BY-SA 3.0