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 }
);
}
}
Try to add the nugget package : Microsoft ASP.NET Web API 2.2 OWIN
https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Owin/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With