Serving a static file with servicestack

给你一囗甜甜゛ 提交于 2019-12-05 14:06:57
mythz

ServiceStack is already be able to serve static files by referencing them directly.

Otherwise if you want a service return a file for downloading, you can do so with:

return new HttpResult(new FileInfo("~/app.xap"), asAttachment:true) {
   ContentType = "application/x-silverlight-app"
};

Note: asAttachment will control whether or not to send HTTP Content-Disposition headers.

More info about ServiceStack's responses is in this earlier question: ServiceStack and returning a stream

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