I have published asp.net core 2.2 API to Azure App Service. After last publishing I have been started getting 404 response for PUT method making request from front-end web app, but everything still is ok making request using postman or curl.
Here is the web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Api.dll" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout" />
</system.webServer>
<httpErrors existingResponse="PassThrough" />
</location>
I have added httpErrors
tag to the web.config based on this answer https://stackoverflow.com/a/46200400/11324810, but it didn't solve the problem.
The code even does not imply such a response:
[HttpPut("google-spreadsheet/sheet-header")]
public async Task<IActionResult> UpdateHeaders([FromBody]UpdateHeadersRequest request)
{
try
{
var provider = await GoogleSheetExporter.CreateSheetProvider(request.SheetUrl, request.UserEmail);
await provider.UpdateHeadersAndRecordsAsync(request.PresentCandidates.ToList(),
request.PreviousHeaders, request.NewHeaders);
return Ok();
}
catch (Exception ex)
{
return StatusCode(500, $"{ex.Message} | {ex.StackTrace}");
}
}
Screeenshots with different responses:
404 response via front-end web app: https://i.stack.imgur.com/sEb2H.png
200 response via Postman: https://i.stack.imgur.com/prI09.png
200 response via curl: https://i.stack.imgur.com/1PHe7.png