Send a large message to a ServiceStack service

流过昼夜 提交于 2019-12-04 18:44:46

Use ServiceStack's ProtoBuf support - protocol buffers is the most efficient and compact wire format out there. Since it's simpler, try that first, before investigating the Streaming options in ServiceStack.

Streaming options in ServiceStack

If you've identified that your service will greatly benefit from Streaming, than here's an article on sending a stream to ServiceStack that shows how to Stream inside ServiceStack services. It shows how to use IRequiresRequestStream which lets you stream the Request Body in your services:

Request DTO:

[Route("/upload/{FileName}", "POST")]
public class UploadPackage : IRequiresRequestStream
{
    public System.IO.Stream RequestStream { get; set; }

    public string FileName { get; set; }
}

Access to the Request Body Stream is injected into the RequestStream property of the Request DTO.

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