Owin Selfhost: deal with large files

╄→гoц情女王★ 提交于 2019-12-11 10:14:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!