Could not load file or assembly Microsoft.Owin, Version=3.0.1.0

Ben Wilson 20 Reputation points
2024-03-19T05:56:35.4433333+00:00

I read similar posts at this forum but my situation is unique.

The error suddenly appeared after a successful deployment to Azure web app. The .Net framework is 4.7.2. There was no code change. The local run has no issue. Previous deployments were successful. I cloned the project from Git to another location, re-deployed it, but got the same error.

Here are what strange (or unique) about my situation.

  1. I found not find anything in my project referencing the MS Owin version 3.0.1. At either web.config or the csproj file, only version 4.0.1.0 is referenced.
  2. I tried upload MS Owin 3.0.1 dll to the app via sftp, then I got the error - could not load file or assembly Microsoft.Owin, Version=4.0.1.0.

The root cause might be that both MS Owin 3.0.1.0 and 4.0.1.0 were somehow referenced by my project. Is this possible?

Thank you and regards,

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,965 questions
Developer technologies | ASP.NET | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Ben Wilson 20 Reputation points
    2024-03-20T05:42:43.01+00:00

    Lex,

    Thanks for the reply. By "MSBuild bin" log, you mean the "Build" output of Visual Studio 2022, right? I reviewed it but did not see any new info. I checked the directory obj\Release\Package\PackageTmp and the file "Microsoft.Owin.dll" had the correct version.

    To elimiate other factors, I updated the project to dotnet framework 4.8 and Microsoft.Owin to 4.2.2 (latest version). Below is the assembly redirect in web.config.

        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35"/>
    
        <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0"/>
    

    Then I got the error "Could not load file or assembly 'Microsoft.Owin, Version=4.0.1.0" after the deployment.

    Any suggestions?

    Regards,


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.