using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; namespace Jwt.Gateway { public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) { var config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true) .Build(); return WebHost.CreateDefaultBuilder(args) .UseKestrel() .UseConfiguration(config) .UseStartup<Startup>() .Build(); } } } Program.cs
运行截图
[运行截图-获取Token] [运行截图-配置Fiddler调用接口获取数据] [运行截图-获取到数据]如果Token校验失败将会返回401错误!