简体   繁体   中英

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

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)

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

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.

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.

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!

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.

转到参考并单击 Microsoft.Owin 以查看您已安装的版本,然后转到 web.config 并将 Microsoft.Owin 下的参考更改为 3.0.1.0,然后转到 Package.config 并更改为相同的。如果您没有想要任何问题。在 Manage Nudget Packages 上为所有问题安装不同的软件包版本,然后重复您之前执行的引用过程

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies 'Could not load file or assembly 'Microsoft.ServiceBus, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies Could not load file or assembly 'Microsoft.CodeAnalysis, version= 1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependenc Could not load file or assembly 'Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM