一共要修改两处地方:
一丶Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc(config => config.Filters.Add<AuthFilter>())
.AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver())
.SetCompatibilityVersion