2
votes

My Website is working properly in local server But when publish it on azure and run then it give me this error of Could not load file or assembly 'Microsoft.Owin, Version=4.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).

<packages>
  <package id="Antlr" version="3.5.0.2" targetFramework="net472" />
  <package id="bootstrap" version="3.4.1" targetFramework="net472" />
  <package id="jQuery.Validation" version="1.17.0" targetFramework="net472" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net472" />
  <package id="Microsoft.Azure.Amqp" version="2.4.2" targetFramework="net472" />
  <package id="Microsoft.Azure.Devices" version="1.4.1" targetFramework="net472" />
  <package id="Microsoft.Azure.Devices.Shared" version="1.16.0" targetFramework="net472" />
  <package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net472" />
  <package id="Microsoft.Azure.Services.AppAuthentication" version="1.0.3" targetFramework="net472" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net472" />
  <package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="3.14.2" targetFramework="net472" />
  <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.11" targetFramework="net472" />
  <package id="Microsoft.Owin" version="3.0.1" targetFramework="net472" />
  <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net472" />
  <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net472" />
  <package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net472" />
  <package id="Microsoft.Rest.ClientRuntime" version="2.3.20" targetFramework="net472" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net472" />
  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" targetFramework="net472" />
  <package id="Modernizr" version="2.8.3" targetFramework="net472" />
  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net472" />
  <package id="Owin" version="1.0" targetFramework="net472" />
  <package id="PCLCrypto" version="2.0.147" targetFramework="net472" />
  <package id="PInvoke.BCrypt" version="0.3.2" targetFramework="net472" />
  <package id="PInvoke.Kernel32" version="0.3.2" targetFramework="net472" />
  <package id="PInvoke.NCrypt" version="0.3.2" targetFramework="net472" />
  <package id="PInvoke.Windows.Core" version="0.3.2" targetFramework="net472" />
  <package id="System.IdentityModel.Tokens.Jwt" version="4.0.4.403061554" targetFramework="net472" />
  <package id="System.IO" version="4.1.0" targetFramework="net472" />
  <package id="System.Net.WebSockets" version="4.0.0" targetFramework="net472" />
  <package id="System.Net.WebSockets.Client" version="4.0.2" targetFramework="net472" />
  <package id="System.Runtime" version="4.1.0" targetFramework="net472" />
  <package id="System.Runtime.Serialization.Primitives" version="4.1.1" targetFramework="net472" />
  <package id="System.Security.Cryptography.Algorithms" version="4.2.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.Encoding" version="4.0.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.Primitives" version="4.0.0" targetFramework="net472" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.1.0" targetFramework="net472" />
  <package id="Validation" version="2.2.8" targetFramework="net472" />
  <package id="WebGrease" version="1.6.0" targetFramework="net472" />
  <package id="WindowsAzure.ServiceBus" version="6.0.0" targetFramework="net472" />
  <package id="WindowsAzure.Storage" version="9.1.1" targetFramework="net472" />
</packages>
1
Sounds as if a dll is missing / cannot be foundalexherm
Yes and i found solution just add <add key="owin:AutomaticAppStartup" value="false" />. because i dont need yet owin .Hassan Shabbir

1 Answers

1
votes

As i can see in your packages.config, Microsoft.owin version is

**<package id="Microsoft.Owin" version="3.0.1" targetFramework="net472" />**

And your application is Errorin out **Could not load file or assembly 'Microsoft.Owin, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'**

Please try to add dependent assembly tag in your web.config like below

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

See if it works, Also if you are using 4.0.0 version in your project then consider updating the reference in your packages.config as well.

Hope it helps.