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

后端 未结 15 1747
半阙折子戏
半阙折子戏 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:10

    If you have multiple projects in your solution and one of your projects fails to build because of this error then ensure you have installed the WebApi Core nuget package in that project. Simply adding a reference to the System.Web.Http does not help, you need to install the correct nuget package into that project.

    I had multiple projects in my solution and WebApi Core was already installed in another project. I referenced the System.Web.Http assembly by right-clicking and ticking the assembly from the list and it did not work on Azure, though locally it would build okay. I had to remove the manual reference and add the WebApi Core nuget package to each project that needed the assembly reference.

提交回复
热议问题