Could not load file or assembly 'Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

8

My code works just fine locally but after I published to server I keep getting this error:

Could not load file or assembly 'Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I don't even have a Microsoft.Owin Version 3.0.1.0 in this project, the version used in this project is 2.0.0.0. Then I tried to update the Owin and the dependencies file but to no avail. Even after deleting the Bin folder and rebuild the code I am still having the same issue.

Anybody can help me on this?

EDIT: After adding this to the Web.Config:

<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>

This is what I got:

Could not load file or assembly 'file:///C:\Project\bin\Microsoft.Owin.dll' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

c#
.net
asp.net-mvc
owin
asked on Stack Overflow Oct 11, 2017 by Ng Zen • edited Oct 11, 2017 by Ng Zen

5 Answers

3

I had this problem after updating packages in my solution. I was able to resolve it by re-installing Microsoft.Owin.

From the Package Manager Console, in Visual Studio: update-package microsoft.owin

Upon completion, I was able to run my app again.

answered on Stack Overflow Dec 24, 2019 by mcolegro
1

Verify the installed Microsoft.Owin package version [In Manage Nuget Packages] with Web.config -> Microsoft.Owin version.

Both these versions should match.

This one worked for me

answered on Stack Overflow Nov 28, 2018 by Sadiq • edited May 10, 2020 by Sadiq
1

I had the same issue for 4.1.0.0 vs 4.0.1.0 where the error was showing 3.0.1.0 so make sure to check Web.config and set to correct version that is in the .csproj. In my case, I had to update Web.config and replace 4.0.1.0 with 4.1.0.0. The updating package did nothing until the versions matched.

answered on Stack Overflow Apr 23, 2020 by Dmitri K
0

I've also had this a few times. Installing the nuget package (and accepting the license) always did the trick for me.

so, rightclick your project in visual studio (?), manage nuget-packages. Look for installed tab, delete if so. Then tab browse, and look for Microsoft.Owin (there are a few), install them and you are ready to go!

answered on Stack Overflow Oct 11, 2017 by Roelant M
0

Go to the Nuget Package Manager and Update all the packages(If needed) or Update Owin Packages and again build and run the server. This works for me.

answered on Stack Overflow Dec 26, 2019 by Sangeeth Sajan

User contributions licensed under CC BY-SA 3.0