Last post Mar 15, 2019 07:54 AM by Xing Zou
Mar 15, 2019 12:54 AM|Test1233@|LINK
Mar 15, 2019 01:59 AM|Xing Zou|LINK
I can't seem to wrap my head around the need for app.UseStaticFiles() middle ware because no matter what application we create,we will need to include something or the other static files
If we create an asp.net core web api project , we do not need to include static files to some extent.
In a web application,we need to use app.UseStaticFiles() to enable serving of static files.
Besides, Static File Middleware could also act as a terminal middleware by processing a request
for a static file and short-circuiting the rest of the pipeline.
When a delegate doesn't pass a request to the next delegate, it's called short-circuiting the request pipeline. Short-circuiting is often desirable because it avoids unnecessary work.
Mar 15, 2019 03:14 AM|Test1233@|LINK
Mar 15, 2019 04:25 AM|bruce (sqlwork.com)|LINK
f you are running behind a proxy, say like ngnix, it has fantastic static file handling with compression, caching, and load balancing, so you would not need the static file handler. if you are running asp.net core without a proxy, you need a static file
Mar 15, 2019 04:49 AM|Xing Zou|LINK
If you do not call the `next()` method in your middleware, it will short-circuiting the pipeline. In any situation when you do not want to call the next middleware any more and return the response directly, you could apply it.
Foe example, when the user is not authenticated or does not have permissions, the authorization middleware can short-circuit the pipeline.
You could refer to below links which explain it clearly:
Mar 15, 2019 06:34 AM|Test1233@|LINK
Mar 15, 2019 07:54 AM|Xing Zou|LINK
Try to use below code to cut off the pipeline
app.MapWhen(c => true, b =>