We have a .NET core WEB-API which have an endpoint that provide a file. The endpoint is called from NB-IoT devices (very low bandwidth). The download takes up to 2 miuntes (for 90KB).
We want to track how long the download takes on the server. But if I add a middleware for tracking, I only get the request time (some milli seconds), not the time how long data is transmitted to the client through a TCP connection.
We tried a lot of logging, but I was not able to get the real download time.
You need to log the time at the server-side when the download starts and ends.
You need a middleware to handle it.
MiddleWare:
Add Middleware to the Startup:
This middleware will track the duration of all requests
Front End side You can use this code: