I am trying to learn ServiceStack with the hello world examples and self-hosted example. I am making requests for JSON content.
I have noticed the following in the response headers:
Basic service hosted in an ASP.Net project:
HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Wed, 10 Apr 2013 12:49:46 GMT
X-AspNet-Version: 4.0.30319
X-Powered-By: ServiceStack/3.943 Win32NT/.NET
Cache-Control: private
Content-Type: application/json; charset=utf-8
Content-Length: 16 <-------------------------------------
Connection: Close
Same basic service, self-hosting (command line):
HTTP/1.1 200 OK
Transfer-Encoding: chunked <-------------------------------
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
X-Powered-By: ServiceStack/3.943 Win32NT/.NET
Date: Wed, 10 Apr 2013 12:48:50 GMT
It seems the self-hosted variety does not buffer it's responses? Is this a performance or compatibility concern?
How can I turn on buffering when using the self-hosting method?
Many thanks.
How can I turn on buffering when using the self-hosting method?
You could create a ResponseFilter like below. I would say this is kind of aggressive and it would prevent other ResponseFilters from running. You could turn it into a Filter Attribute and only use it when there is a clear performance benefit for the Response. Otherwise, I would just let the AppHost handle the Response.