运行ASP.NET 自承载WebApi服务器报错:未能加载文件或程序集System.Web.Http或它的某一个依赖项
运行ASP.NET 自承载WebApi服务器报错:未能加载文件或程序集System.Web.Http或它的某一个依赖项
未能加载文件或程序集“System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)
扫一扫加微信
运行ASP.NET 自承载WebApi服务器报错:
解决方案:
工程项目-->鼠标右键-->管理NuGet程序包,添加:Microsoft.AspNet.Mvc
并确认是否添加以下的NuGet包:
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
<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
扫一扫加微信
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网