运行ASP.NET 自承载WebApi服务器报错:未能加载文件或程序集System.Web.Http或它的某一个依赖项
作者:C/S框架网|www.cscode.ne  发布日期:2020-04-02 11:50:53
  运行ASP.NET 自承载WebApi服务器报错:未能加载文件或程序集System.Web.Http或它的某一个依赖项

运行ASP.NET 自承载WebApi服务器报错:未能加载文件或程序集System.Web.Http或它的某一个依赖项

运行ASP.NET 自承载WebApi服务器报错:

未能加载文件或程序集“System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)


解决方案:


工程项目-->鼠标右键-->管理NuGet程序包,添加:Microsoft.AspNet.Mvc

并确认是否添加以下的NuGet包:


贴图图片-ASPNETWebApi服务器搭建详解自承载102


packages.config

XML Code:

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Cors" version="5.2.7" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Cors" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.7" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net45" />
<package id="Microsoft.Net.Compilers" version="3.5.0" targetFramework="net45" developmentDependency="true" />
<package id="Microsoft.Owin" version="4.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Cors" version="4.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.HttpListener" version="4.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.SystemWeb" version="4.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Hosting" version="4.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security" version="4.1.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="System.Net.Http" version="4.3.3" targetFramework="net45" />
<package id="WebApiThrottle" version="1.5.4" targetFramework="net45" />
</packages>

//来源:C/S框架网 | www.csframework.com | QQ:23404761




C/S框架网|原创精神.创造价值.打造精品

扫一扫加微信
C/S框架网作者微信 C/S框架网|原创作品.质量保障.竭诚为您服务

上一篇 下一篇