title: Download large files from Owin self-hosted web service
body: <p>I am currently working on an Owin self-hosted web service that runs on my machine and that allows peers (other machines) to download files from its virtual directory with <a href="https://en.wikipedia.org/wiki/Background_Intelligent_Transfer_Service" rel="nofollow noreferrer">microsoft's BITS</a>. The downloads will work with relatively small files, but whenever I have to download large files (over 2Go) I get this error from BITS: </p>
  
  <blockquote>
    <p>"The server does not support the necessary HTTP protocol. Background
    Intelligent Transfer Service (BITS) requires that the server support
    the Range protocol header."</p>
  </blockquote>
  
  <p>I was wondering if there was a way to enable the Range Requests in Owin or if I have to implement manually the "data chunking" in the requests I receive. Because changing the content of every request to have the header "Accept-Ranges: bytes" doesn't seem to work (I assumed it would not magically worked, but I tried it anyway).</p>
  
  <p>I couldn't find a lot of information on what I am trying to do besides finding out how to know if a server is supporting the range requests.</p>
  
  <p>There was <a href="https://stackoverflow.com/questions/7527799/how-do-you-set-up-the-correct-http-response-object-for-a-range-request-coming-fr">this question</a> that seemed to look similar to mine, but was more focussed on setting the headers properly. It doesn't really show if/how the code splits the file before returning the response. There was also something about IIS, but my web service doesn't run on IIS, it runs on the client's machine and is instanciated by a windows service.</p>