Luis Teijon
Luis Teijon

Reputation: 4899

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 }
            );
        }
    }

Upvotes: 17

Views: 18860

Answers (1)

Yanga
Yanga

Reputation: 3012

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

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

Upvotes: 28

Related Questions