Я столкнулся с проблемой ниже. При запуске проекта возникает исключение «KeyNotFoundException: указанный ключ отсутствует в словаре».
public void ConfigureServices(IServiceCollection services)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
// Add framework services.
services.AddMvc(options =>
{
options.Filters.Add(new CustomExceptionFilterAttribute());
options.ReturnHttpNotAcceptable = true;
// options.OutputFormatters = xml
})
.AddJsonOptions(options =>
{
//For Maintaining Json Format
options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver();
});
}
Ваша помощь будет оценена.