WebApi Timeout Settings with Owin Offline Hosting

I have my own Owi-based Api web server and I'm wondering if I need to change the timeout settings when there are huge file downloads? The client I'm using is reading the response with HttpCompletionOption.ResponseHeadersRead.

During debugging, after I stopped for a while at the breakpoint, I received an exception on the client side while trying to read from the received stream:

Unable to read data from the transport connection: the existing connection was forcibly closed by the remote host.

During debugging, I can reproduce this problem. This happens after about 30 seconds, waiting at the breakpoint after the Get-Request returns to the server.

Is it because of some kind of idle timeout because I am holding onto a breakpoint and not working on the received stream? Or can this happen when I read from a stream, when my collection is slow, and is it taking too long?

+4
source share
1 answer

A very old question, but it can help someone who gets on the same wall. I had the same issue with streaming content and found the source key inside the folderHTTPERR (C:\Windows\System32\LogFiles\HTTPERR)

 2016-08-12 09:17:52 ::1%0 60095 ::1%0 8000 HTTP/1.1 GET 
 /endpoint/audiostream/0/0/streamer.mp3 - - - Timer_MinBytesPerSecond -

 2016-08-12 09:18:19 ::1%0 60118 ::1%0 8000 HTTP/1.1 GET 
 /endpoint/audiostream/0/0/streamer.mp3 - - - Request_Cancelled -

Owin HttpListenerhas a property TimeOutManagerthat allows you to change most timeouts / restrictions. The only way I found my webapp instance HttpListeneris to access its properties

var listener = (OwinHttpListener);
app.Properties["Microsoft.Owin.Host.HttpListener.OwinHttpListener" ]);
listener.Listener.TimeoutManager.MinSendBytesPerSecond = uint.MaxValue;

According to Owincodebase, uint.MaxValuehow to MinSendBytesPerSecondsimply disable the flag.

+2

Source: https://habr.com/ru/post/1615785/


All Articles