Could not load file or assembly 'Microsoft.Owin, Version=3.0.1.0'
See original GitHub issueHello, I am encoutering this error on my ASP.NET web application : 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 do indeed have a dependency to Microsoft.Owin in my project. But my project is using the latest version (4.0.1.0) and in my web.config my redirects are configured to redirect to it.
<dependentAssembly> <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> </dependentAssembly>
Here is where it get’s weird. Locally, it works just fine, I can build it and run it in debug or release mode. The build in my build pipeline on Azure DevOps also works great.
However, the deployed version (deployed in Azure) does not work. The landing page (which is a login page) works fine, but as soon as I try and login, I get a yellow screen wih this message:
`An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[WebException: The remote server returned an error: (500) Internal Server Error.] System.Net.HttpWebRequest.GetResponse() +1399 System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +55
[ProtocolException: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: ’ `<!DOCTYPE html>
<html> <head> <title>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)</title> <meta name="viewport" content="width=device-width" /> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} .marker {font-weight: bold; color: black;text-decoration: none;} '.]`I have tried every fix I could find online, had help from multiple people and nothing could fix this. Looking forward to get your answers. Cheers
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Giving anybody who comes accross this issue the “solution” that worked for me. I published my app from Visual Studio. There is a checkbox that needs to be checked to ensure that basically a clean is done on the environment. It worked this way. I thought I configured my Azure DevOps release pipeline to do the same task but apparently for some reason (most likely my fault) it wasn’t done right.
Thank you for your advice. I have opened a ticket with Microsoft Support and will post the solution once it is all figured out.