You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.NET 8 has a new feature for short circuiting routes. We should document it.
Some notes that may be useful...
When routing matches an endpoint it typically lets the rest of the middleware pipeline run before invoking the endpoint logic. If that's not necessary or desirable, there's a new option that will cause routing to invoke the endpoint logic immediately and then end the request. This can be used to efficiently respond to requests that don't require additional features like authentication, CORS, etc., such as requests for robots.txt or favicon.ico.
app.MapGet("/",()=>"Hello World").ShortCircuit();
You can also use the MapShortCircuit method to setup endpoints that send a quick 404 or other status code for matched resources that you don't want to further process.
.NET 8 has a new feature for short circuiting routes. We should document it.
Some notes that may be useful...
When routing matches an endpoint it typically lets the rest of the middleware pipeline run before invoking the endpoint logic. If that's not necessary or desirable, there's a new option that will cause routing to invoke the endpoint logic immediately and then end the request. This can be used to efficiently respond to requests that don't require additional features like authentication, CORS, etc., such as requests for robots.txt or favicon.ico.
You can also use the
MapShortCircuit
method to setup endpoints that send a quick 404 or other status code for matched resources that you don't want to further process.More info:
EDIT by @Rick-Anderson to add the following metadata
Provide link in https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/ doc to
ShortCircuit
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
Associated WorkItem - 85531
The text was updated successfully, but these errors were encountered: