Lui*_*jon 12 .net c# asp.net-web-api
我创建了一个ASP.NET-WebApi应用程序,我遇到了这个错误:
HttpConfiguration不包含SuppressDefaultHostAuthentication的定义
代码是自动生成的,我认为它必须是一个引用,但无法找到该引用.
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 }
);
}
}
Run Code Online (Sandbox Code Playgroud)
Yan*_*nga 20
尝试添加块包:Microsoft ASP.NET Web API 2.2 OWIN
https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Owin/
| 归档时间: |
|
| 查看次数: |
11514 次 |
| 最近记录: |