.NET Core API request does not match supported file type

I just want to make sure that I have no problem. Does anyone know what causes

2017-03-17 07:59:17.5838|1|Microsoft.AspNetCore.Hosting.Internal.WebHost|INFO|Request starting HTTP/1.1 GET http://192.168.20.57:8081/hardware/configuration/active application/json 2017-03-17 07:59:17.5868|4|Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware|DEBUG|The request path /hardware/configuration/active does not match a supported file type 

I am only viewing the Kestrel web API (without IISIntegration).

The request header contains

 GET /hardware/configuration/active HTTP/1.1 Accept: application/json, text/plain, */* Content-Type: application/json 

Defining [Produces("application/json")] explicitly in my controller has no effect.

+5
source share
1 answer

After the request comes the kestrel (which is your first line of the log).

First, it goes through the middleware pipeline until it reaches the WebApi middleware.

As you can see in the second line of logging: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware . It reached StaticFileMiddleware , not WebApi middleware.

Does staticFileHandler probably find the file in the wwwroot folder and thus return this message? Or even before he tries to check the file system, he checks to see if this is a permitted / known file extension, and it is not, so this is the second log message.

0
source

Source: https://habr.com/ru/post/1265595/


All Articles