问题
I found this article: http://www.strathweb.com/2012/09/dealing-with-large-files-in-asp-net-web-api/
It tells how to set the TransferMode when Selfhosting with System.Web.Http.Selfhost.
Is there a similar way to set the TransferMode to Streaming when selfhosting with Owin instead?
回答1:
As far as I can tell Microsoft's Owin server already streams all uploads and downloads. How you handle this data in your WebApi (or equivalent) determines whether or not it gets fully buffered or stays as a stream.
For serving file downloads, make sure that the response content is a StreamContent. For file uploads, this depends on what format the message body is in. For example, this answer covers streaming multipart content to disk
来源:https://stackoverflow.com/questions/31520655/owin-selfhost-deal-with-large-files