Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpConfiguration does not contain a definition for SuppressDefaultHostAuthentication

I created an ASP.NET-WebApi application and I've got this error:

HttpConfiguration does not contain a definition for SuppressDefaultHostAuthentication

The code was auto-generated, I think it has to be a reference, but couldn't find that reference.

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 }
            );
        }
    }
like image 400
Luis Teijon Avatar asked Nov 19 '16 02:11

Luis Teijon


1 Answers

Try to add the nugget package : Microsoft ASP.NET Web API 2.2 OWIN

https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Owin/

like image 106
Yanga Avatar answered Nov 15 '22 06:11

Yanga