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


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.' 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
asked on Stack Overflow Apr 18, 2016 by Sandi Horvat

5 Answers


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


answered on Stack Overflow Apr 18, 2016 by Sandi Horvat

There is a known issue in Azure Functions host:

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

answered on Stack Overflow Feb 8, 2021 by Marek Stój

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

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 and in web config, it shows me different. I have changed it to and everything works fine.

web.config version

answered on Stack Overflow Jun 15, 2020 by jeet

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