Linux update
From release v4.5.2, ServiceStack now supports .NET Core, which offers significant performance and stability improvements over Mono, which are derived from a common cross-platform code base and are supported by Microsoft, which has sufficient resources, an active and responsive team. If you are currently running ServiceStack on Mono, we highly recommend switching to .NET Core to take advantage of its superior performance, stability, and top-down technology support.
Update for mono
Our recommended installation for hosting ASP.NET sites on Linux and Mono is to use nginx / HyperFastCgi. We have published a step-by-step guide on creating an Ubuntu virtual machine from scratch using the deploy / install / conf / init scripts in mono-server-config .
We no longer recommend MonoFastCGI, noting several stability and performance issues. This blog post provides a good analysis of the performance, memory usage, and stability of various ASP.NET hosting options in Mono .
Development
XSP is like VS.NET WebDev, a simple stand-alone ASP.NET WebServer written in C #. It is suitable for development or small workloads. You simply run it from the root directory of your ASP.NET ServiceStack node, which will make it available at http://localhost:8080 .
Products
For external Internet services, you usually want to host ServiceStack web services as part of a full-featured web server. The 2 most popular full-featured web servers for Linux:
Nginx
Use Mono FastCGI to host HostStStStStack hosts in Nginx .
Apache
Use mod_mono to host HostStStStStack hosts in an Apache HTTP server .
Self hosting
ServiceStack also supports self-hosting, which allows you to run ServiceStack web services on your own in a standalone console application (i.e. without a web server). This is a good idea when you do not need the services of a full-featured web server (for example, you just need to host web services inside Intranet).
By default, the same ServiceStack Console application binary works on both Windows / .NET and Mono / Linux as it is. Although, if you want, you can easily unmount your application and start as a Linux daemon, as described here . The wiki page also contains instructions for setting up your own web service to work with a reverse Nginx or Apache proxy.
Since it is great for the Heroku Concurrency model as described in their 12-factor example , self-service will be an area in which we will strive to increase support in the near future.
ServiceStack.net Nginx / Mono FastCGI Configuration
The servicestack.net website itself (including all demos) runs on Ubuntu hetzner vServer using Nginx + Mono FastCGI.
This command is used to start the FastCGI background process:
fastcgi-mono-server4 --appconfigdir /etc/rc.d/init.d/mono-fastcgi /socket=tcp:127.0.0.1:9000 /logfile=/var/log/mono/fastcgi.log &
In which all applications defined in * .webapp files are located in the /etc/rc.d/init.d/mono-fastcgi folder specified using the XSP WebApp file format , for example:
ServiceStack.webapp:
<apps> <web-application> <name>ServiceStack.Northwind</name> <vhost>*</vhost> <vport>80</vport> <vpath>/ServiceStack.Northwind</vpath> <path>/home/mythz/src/ServiceStack.Northwind</path> </web-application> </apps>
This starts the FastCGI Mono process in the background, with which you can connect to Nginx by adding this rule to nginx.conf:
location ~ /(ServiceStack|RedisAdminUI|RedisStackOverflow|RestFiles)\.* { root /usr/share/nginx/mono/servicestack.net/; index index.html index.htm index.aspx default.htm Default.htm; fastcgi_index /default.htm; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/share/servicestack.net$fastcgi_script_name; include /etc/nginx/fastcgi_params; }
Any route starting with /ServiceStack or /RedisAdminUI , etc. will be redirected. to the FastCGI monoserver process for processing. Some sample applications are placed this way:
For those who are interested in the full Nginx + FastCGI configuration file for servicestack.net, it is available for download .