5

I got an Owin self-hosted web-api server, and I'm wondering if I need to change timeout settings when there are huge file downloads? The client I'm using reads the response withHttpCompletionOption.ResponseHeadersRead.

During debugging, after I stopped for some time in a breakpoint, I got an exception on client side while trying to read from a received stream:

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

While debugging I can reproduce this issue. It happens after around 30 seconds waiting in a breakpoint, after the Get-Request to the server returned.

Is this due to some kind of idle timeout, because I hold in a breakpoint and do not work on the received stream? Or can it also happen while I'm reading from the stream when my collection is slow and it takes too long?

1 Answer 1

3

Very old question but may help whoever hits the same wall. I had the same problem with a streaming content and found the initial clue inside HTTPERR folder (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 HttpListener has a TimeOutManager property that allows you to change most timeout/limits. The only way I found to get my webapp HttpListener instance was by accessing its properties

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

According to owin codebase, uint.MaxValue as MinSendBytesPerSecond will just disable the flag.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.