asp.net core - Custom AspCore Middleware with cancellation Token -
when have custom asp core middle ware want retrieve cancellation token request
i tried add signature of invoke this:
public async task invoke(httpcontext context,cancellationtoken token)
but son add it isn't called more.
what doing wrong?
i think idea not able cancel invocation of middleware, inside middleware if call async task accepts cancellation token can create 1 , pass in calling inside there.
a common scenario cancel task if request aborted, create token this:
cancellationtoken cancellationtoken => context?.requestaborted ?? cancellationtoken.none;
and call async service getting data or querying db, if request aborted cancellation request should happen
Comments
Post a Comment