У меня есть код, который отправляет запрос Ajax. Это приложение .NET Core.
$.ajax({
url: "your_api_endpoint", // The URL to send the request to
method: "GET", // HTTP method (GET, POST, PUT, DELETE, etc.)
data: { // Data to be sent to the server (optional)
param1: "value1",
param2: "value2"
},
dataType: "json", // Expected data type of the response (json, xml, text, html)
success: function(response) {
// Function to execute on successful request
console.log("Success:", response);
},
error: function(jqXHR, textStatus, errorThrown) {
// Function to execute on request error
console.error("Error:", textStatus, errorThrown);
},
complete: function() {
// Function to execute after the request completes (success or error)
console.log("Request complete.");
}
});
Я получаю сообщение об ошибке.
Модуль фильтрации запросов настроен на отклонение запроса, если строка запроса слишком длинная.
Все решения, которые я искал, где изменить файл web.config. В моем проекте нет файла web.config. Это приложение .NET Core. Могу ли я решить эту проблему в файле appsettings.json?
Я установил
return new WebHostBuilder()
.UseKestrel(opt =>
{
opt.AddServerHeader = false;
//opt.Limits.MaxRequestLineSize = 16 * 1024;
opt.Limits.MaxRequestLineSize = 302768;
})
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIIS()
.UseIISIntegration()
.UseStartup();
Подробнее здесь: https://stackoverflow.com/questions/798 ... ed-to-deny