ServiceStack CORS Feature

Because ServiceStack’s Old API enforced an interface-based API it only supported GET, POST, PUT, DELETE, PATCH requests. Handling OPTION requests we’re essentially a stop-gap work-around that had a single implementation to just emit the configured headers and close the response. With ServiceStack’s New API there is no longer any limitation as you can now handle … Read more

ServiceStack and returning a stream

Yes returning an IHttpResult will allow you to control the exact payload, Content-Type and other HTTP Headers as you wish. Also you’re not limited to returning a stream, i.e. you can use the HttpResult to return an xml string with a different Content-Type. Here are some links that better demonstrate what’s possible with ServiceStack return … Read more

Does ServiceStack support binary responses?

I love service stack, this litle code was enough to return an Excel report from memory stream public class ExcelFileResult : IHasOptions, IStreamWriter { private readonly Stream _responseStream; public IDictionary<string, string> Options { get; private set; } public ExcelFileResult(Stream responseStream) { _responseStream = responseStream; Options = new Dictionary<string, string> { {“Content-Type”, “application/octet-stream”}, {“Content-Disposition”, “attachment; filename=\”report.xls\”;”} … Read more