The docs on Service Return Types shows how to return image responses, techniques which are used in ServiceStack's imgur.servicestack.net demo.
An alternative solution would be to get an industrial strength webserver like nginx to serve the static file instead, thus completely avoiding ServiceStack, ASP.NET or any managed .NET code, which you can do by writing to a static file and redirecting to it.
This is how you can configure nginx to serve all static files in /img/
and add cache headers to static files that have common web formats file extensions (ico|pdf|flv|swf|exe|txt|css):
server {
listen 0.0.0.0:80;
server_name myserver.net;
root /home/src/myserver.net;
location /img/ {
alias /home/src/myserver.net/img/;
}
location ~* \.(ico|pdf|flv|swf|exe|txt|css) {
add_header Cache-Control public;
add_header Cache-Control must-revalidate;
expires 1d;
}
location / {
index index.html index.htm index.aspx default.htm default.aspx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}