When we use C# to develop WebApi and other related programs, the error shown in the figure below may occur for some reasons. The reason is that when we compile, the dll library used may be changed from the original one, resulting in inconsistent versions. .
Solution:
Enter Install-Package Microsoft.AspNet.WebApi.WebHost in the package manager console and press Enter and get the latest dll library.