无法加载文件或程序集’System.Web.Http.WebHost’

将MVC网页部署到我的IIS后,我收到以下错误:

Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. 

我已完成以下更改以防止此问题:

  • 为webhost设置Copy Local = True
  • 从nuget添加了WebApi 2.2
  • System.Web.Http.WebHost存在于i bin文件夹中
  • 我的web.config有以下dependentAssembly:

码:

      

我仍然得到错误,我做错了什么?

您可能需要检查“views”文件夹中的Web配置,如果您有一个确认它具有正确的绑定重定向,就像您在主Web配置中一样。