C#-无法调用HttpConfiguration扩展方法 [英] C# - Cannot call a HttpConfiguration Extension Methods
本文介绍了C#-无法调用HttpConfiguration扩展方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法调用HttpConfiguration
扩展方法:
using System.Configuration;
using System.Web.Http;
...
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes(); // <-- error
错误:"System.Web.Http.HttpConfiguration"不包含 MapHttpAttributeRoutes的定义,没有扩展方法 'MapHttpAttributeRoutes'接受类型的第一个参数 可以找到"System.Web.Http.HttpConfiguration"(您是否缺少 使用指令还是程序集引用?)
Error: 'System.Web.Http.HttpConfiguration' does not contain a definition for 'MapHttpAttributeRoutes' and no extension method 'MapHttpAttributeRoutes' accepting a first argument of type 'System.Web.Http.HttpConfiguration' could be found (are you missing a using directive or an assembly reference?)
我同时尝试了System.Web.Http版本4和5,以及".NET Framework 4.5.2"和".NET Framework 4".
I tried both with System.Web.Http version 4 and 5, and with ".NET Framework 4.5.2" and ".NET Framework 4".
我想念什么?
查看全文