nenne ich keine HttpConfiguration
Erweiterung Methode aufrufen kann:C# - Es kann keine HttpConfiguration Erweiterungsmethoden
using System.Configuration;
using System.Web.Http;
...
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes(); // <-- error
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?)
Ich habe versucht, beide mit System.Web.Http Version 4 und 5, und mit“.NET Framework 4.5 .2 "und" .NET Framework 4 ".
Was fehlt mir?
Seine adaequat. var config = new System.Web.Http.HttpConfiguration(); config.MapHttpAttributeRoutes(); – sam
@Pietro, stellen Sie sicher, dass Sie einen Verweis auf Assembly System.Web.Http.dll in Ihrem Projekt haben, wo dieser Code ausgeführt wird. Versuchen Sie auch, bin-Ordner zu löschen und dann das Projekt – Nkosi
@ Nkosi neu zu erstellen, ich habe es ausgewählt. Nur ein Zweifel über seine Version. Ich habe: System.Web v. 4.0, System.Web.Http v. 4.0 und System.Web.Http.Owin V. 5.2.3. Ich kann System.Web.Http v. 5.2.3 (um Owin zu entsprechen), aber kein System.Web> 4.0. Könnte das ein Problem sein? – Pietro