Owin Selfhost:处理大文件 [英] Owin Selfhost: deal with large files

查看:213
本文介绍了Owin Selfhost:处理大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了这篇文章: http://www. strathweb.com/2012/09/处理带有大文件的asp-net-web-api/

I found this article: http://www.strathweb.com/2012/09/dealing-with-large-files-in-asp-net-web-api/

它告诉您如何在使用System.Web.Http.Selfhost进行自我托管时设置TransferMode.

It tells how to set the TransferMode when Selfhosting with System.Web.Http.Selfhost.

当用Owin进行自我托管时,是否有类似的方法将TransferMode设置为Streaming?

Is there a similar way to set the TransferMode to Streaming when selfhosting with Owin instead?

推荐答案

据我所知,Microsoft的Owin服务器已经流式传输了所有上载和下载的内容.您如何在WebApi(或等效文件)中处理这些数据,确定该数据是否被完全缓冲或保留为流.

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.

对于提供文件下载,请确保响应内容为StreamContent.对于文件上传,这取决于消息正文的格式.例如,此答案涵盖了将多部分内容流式传输到磁盘

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

这篇关于Owin Selfhost:处理大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆