0
votes

WebApi throwing error loading the Microsoft.Owin 3.0 assembly during runtime. Could someone help me with the below error:

Could not load file or assembly 'Microsoft.Owin, Version=3.0.0.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 have the binding redirect in my web.config too:

<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>

I have these NuGet packages installed in my project. I have the Microsoft.Owin and Microsoft.Owin.Host.SystemWeb versions pointing to the latest 3.0.1 packages. Not sure which other package referring to the 3.0.0 dll version:

Antlr" version="3.5.0.2"

Bond.Runtime.CSharp" version="3.0.4"

Microsoft.AspNet.Mvc" version="5.2.3"

Microsoft.AspNet.Providers.Core" version="1.1"

Microsoft.AspNet.Providers.LocalDB" version="1.1"

Microsoft.AspNet.Razor" version="3.2.3"

Microsoft.AspNet.Web.Optimization" version="1.1.3"

Microsoft.AspNet.WebApi" version="5.2.3"

Microsoft.AspNet.WebApi.Client" version="5.2.3"

Microsoft.AspNet.WebApi.Core" version="5.2.3"

Microsoft.AspNet.WebApi.WebHost" version="5.2.3"

Microsoft.AspNet.WebPages" version="3.2.3"

Microsoft.Autopilot.AutoIIS" version="7.7.0.0"

Microsoft.Data.Edm" version="5.6.2"

Microsoft.Data.OData" version="5.6.2"

Microsoft.Data.Services.Client" version="5.6.2"

Microsoft.Diagnostics.Tracing.EventRegister" version="1.0.26"

Microsoft.Diagnostics.Tracing.EventSource" version="1.0.26"

Microsoft.Diagnostics.Tracing.EventSource.Redist" version="1.0.26"

Microsoft.Diagnostics.Tracing.TraceEvent" version="1.0.23"

Microsoft.IdentityModel.Protocol.Extensions" version="1.0.0"

Microsoft.Owin" version="3.0.1"

Microsoft.Owin.Host.SystemWeb" version="3.0.1"

Microsoft.Owin.Security" version="3.0.0"

Microsoft.Owin.Security.ActiveDirectory" version="3.0.0"

Microsoft.Owin.Security.Jwt" version="3.0.0"

Microsoft.Owin.Security.OAuth" version="3.0.0"

Microsoft.Tpl.Dataflow" version="4.5.24"

Microsoft.Web.Infrastructure" version="1.0.0.0"

Newtonsoft.Json" version="6.0.8"

Owin" version="1.0"

System.IdentityModel.Tokens.Jwt" version="4.0.0"

System.Spatial" version="5.6.2"

WebGrease" version="1.6.0"

1

1 Answers

1
votes

I ran into this same issue, I downgraded Microsoft.Owin.Security.OAuth from 3.0.1 to 3.0.0then upgrading back to 3.0.1, I also Microsoft.Owin.Security.Jwt to from 3.0.1 to 3.0.0, then upgrading back to 3.0.1,(I know it seems odd) After doing this I noticed that there were duplicate entries in my App.Config and after cleaning and rebuilding, my issue was fixed.