I'm attempting to run an API I've recently developed on Kestrel in .net core 2.1.
My API often returns JSON objects in the region of 100 megabytes. When I started debugging I found to my surprise that it was taking 2-3 minutes to complete a request to my API when both the client and server were running on my localhost (I have not yet tested any other scenario, although I have tried the same code on two different machines, both Windows 10).
Now I do understand that Kestrel isn't the most efficient web server but I'd expected to see a download time of maybe a few seconds.
I've debugged my code repeatedly and have been able to determine that this problem appears to be with kestrel, not my code. To further confirm this I enabled static file support, and placed a copy of one of the JSON files in the wwwroot folder. It too took several minutes to download. That said, in the output from the Kestrel server in the console I see that it reports that the request completed in just 309.82ms. This correlates with Google Chrome's web inspector which shows that the vast majority of the time is spent doing data transfer.
I've tried running in both debug and release modes in case there was some issue that affected debug mode but the result was the same.
I've also tried disabling the MaxResponseBufferSize to see if that would have an affect, but again, it didn't seem to.
I've also tried running this with Kestrel stand alone, with IIS Express and with regular IIS. The timings are all very similar.
Does anyone have any idea what the issue might be here or if there is anything else I could try?