System.Web.Http.GlobalConfiguration不包含“配置的定义 [英] System.Web.Http.GlobalConfiguration does not contain a definition for 'Configure

查看:180
本文介绍了System.Web.Http.GlobalConfiguration不包含“配置的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在全球ASAX CS文件我有这样一行:

In global asax cs file i have this line:

protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
}

这将导致这个错误。

which causes this error.

我曾尝试在其他论坛的建议:

I have tried as suggested on other forums:


  1. 打开包管理器控制台与错误的项目。

  2. 键入安装封装Microsoft.AspNet.WebApi.WebHost并按下回车键

  3. 重建项目,并都应该是正确的与世界(或至少是正确的与您的项目)

输出是:

Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Core (≥ 5.2.2 && < 5.3.0)'.
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Client (≥ 5.2.2)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.4)'.
'Microsoft.AspNet.WebApi.WebHost 5.2.2' already installed.
SM.EORD.Web already has a reference to 'Microsoft.AspNet.WebApi.WebHost 5.2.2'.

和错误仍然存​​在。可能是什么问题?

and error is still there. What could be wrong?

BR,西蒙

推荐答案

在调查我发现,我已经安装的ASP.NET Web API 2.2后,所有的dll的参考路径是从一些旧的Web API的时间 - 它没有采取新的。
新的DLL已经安装包文件夹中,而旧的一个人里面的项目bin文件夹中。

After hours of investigating i have found out that after I have installed ASP.NET Web API 2.2, the reference path of all dlls was from some old Web API - it didn't take the new ones. The new dlls has been installed in packages folder, while the old one were in bin folder inside project.

这篇关于System.Web.Http.GlobalConfiguration不包含“配置的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆