HttpConfiguration does not contain a definition for SuppressDefaultHostAuthentication

I have created an ASP.NET-WebApi application and I have this error:

HttpConfiguration does not contain a definition for SuppressDefaultHostAuthentication

The code was generated automatically, I think it should be a link, but could not find this link.

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 } ); } } 
+6
source share
1 answer

Try adding a nugget package: Microsoft ASP.NET Web API 2.2 OWIN

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

+10
source

Source: https://habr.com/ru/post/1012474/


All Articles