无法加载文件或程序集“System.Web.Http.WebHost”
本文关键字:Web System Http WebHost 程序集 加载 文件 | 更新日期: 2023-09-27 18:32:08
将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.
我做了以下更改来防止此问题:
- 为虚拟主机设置本地复制 = 真
- 添加了来自 nuget 的 WebApi 2.2
- System.Web.Http.WebHost 存在 i bin 文件夹
- 我的 web.config 具有以下依赖项Assembly:
法典:
<dependentAssembly>
<assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
我仍然收到错误,我做错了什么?
您可能需要检查"views"文件夹中的 Web 配置(如果有),以确保它具有正确的绑定重定向,就像您在主 Web 配置中一样。