2016-11-19 21 views
6

için bir tanım içermiyor ve bu hata var:HttpConfiguration Bir ASP.NET-WebAPI uygulaması yarattı SuppressDefaultHostAuthentication

HttpConfiguration does not contain a definition for SuppressDefaultHostAuthentication

kod otomatik oluşturulan, ben bir referans olması gerektiğini düşünüyorum edildi ama bu referansı bulamadı.

using System.Web.Http; 
using Microsoft.Owin.Security.OAuth; 

    public static class WebApiConfig 
    { 
     public static void Register(HttpConfiguration config) 
     { 
      // Web API configuration and services 
      // Configure Web API to use only bearer token authentication. 
      config.SuppressDefaultHostAuthentication(); 

      // Web API routes 
      config.MapHttpAttributeRoutes(); 

      config.Routes.MapHttpRoute(
       name: "DefaultApi", 
       routeTemplate: "api/{controller}/{id}", 
       defaults: new { id = RouteParameter.Optional } 
      ); 
     } 
    } 

cevap