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

Ben Wilson 0 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,

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,256 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,881 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ben Wilson 0 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,