Could not load file or assembly System.Web.Http.WebHost after published to Azure web site

后端 未结 15 1690
半阙折子戏
半阙折子戏 2020-12-07 10:39

I created a web project and it runs well in Visual studio. However, I got the following error after published it to azurewebsites. What can cause the issue?

15条回答
  •  伪装坚强ぢ
    2020-12-07 11:25

    The dll is missing in the published (deployed environment). That is the reason why it is working in the local i.e. Visual Studio but not in the Azure Website Environment.

    Just do Copy Local = true in the properties for the assembly(System.Web.Http.WebHost) and then do a redeploy, it should work fine.

    If you get the similar error i.e. some other assembly missing, then make that assembly to copylocal=true and redeploy, repeat this iteratively - if you are unsure of its dependencies.

提交回复
热议问题