Need help with HyperFastCgi?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

129 Stars 49 Forks MIT License 186 Commits 22 Opened issues


Performant nginx to mono fastcgi server

Services available


Need anything else?

Contributors list

No Data

Build Status


HyperFastCgi hosts mono web applications with nginx. It's a primary replacement of mono-server-fastcgi for linux platform.

Key features: * Does not leak memory * Serves requests much faster. See performance comparison * Open architecture allows developers to write their own extensions or replacements of HyperFastCgi components

Latest stable version



 sudo apt-get install autoconf automake libtool make libglib2.0-dev libevent-dev

For Debian 8 you additionally need to install


Download the source and perform commands:

./ --prefix=/usr
 sudo make install

Installation on FreeBSD


 pkg install mono autoconf automake libtool gmake libevent2 pkgconf

If you want to use the buildin clang instead of gcc you can make a symlink to fool autoconf:

 ln -s /usr/bin/cc /usr/bin/gcc

Download the source and perform commands:

./ --prefix=/usr/local
 gmake install


hyperfastcgi4 /config= [arguments]


  • /config=
    Path to configuration XML file, which holds general settings like listener configuration (Managed or Native, their protocol, address and port), Application Host configuration (AspNet or Custom). The samples of config files can be found in
    directory. This option is required and was introduced in HyperFastCgi v0.4
  • /applications
    Adds applications from a comma separated list of virtual and physical directory pairs. The pairs are separated by colons and optionally include the virtual host name and port to use:
  • /appconfigfile
    Adds application definitions from an XML configuration file, typically with the ".webapp" extension. See sample configuration file that comes with the server.
  • /appconfigdir
    Adds application definitions from all XML files found in the specified directory DIR. Files must have the ".webapp" extension.
  • /logfile
    Specifies a file to log events to.
  • /loglevels
    Specifies what log levels to log. It can be any of the following values, or multiple if comma separated:
  • /printlog
    Prints log messages to the console.
  • /stopable
    Allows the user to stop the server by if "Enter" is pressed. This should not be used when the server has no controlling terminal
  • /version
    Displays version information and exits.

Config file parameters

Samples of config files your can find in


Configuration file is an XML config, which consists of four sections

    ...General server settings is here...
    ... Address, port and related stuff here...
    ... Settings for application host...
        ...Web App1 settings...
        ...Web App2 settings...
        ...Web AppN settings...

Each section except of

has the attribute
which represents fully-qualified CLR type of the class, which will proceed the section. These types provide various behaviour described below and can be written by developer (see Developer section)
    ..server parameters goes here..

All existing types are described in this manual.


  • type
    attribute. Currently can only be set to
    or user-defined type.
  •  element. Type name of the factory, which creates application hosts. Factories can choose how to create application hosts, for example they can create apphost in own domain or in main application domain. Currently there are only one factory 
    which creates application host is their own domain (ASP.NET old-school style)
  •  element. This element has four attrubutes, which defines how many threads will be created at the start
    • min-worker
      minimal number of worker threads
    • max-worker
      maximal number of worker threads
    • min-io
      minimum number of IO completion threads
    • max-io
      maximal number of IO completion threads
  •  element. Sets the root directory for the applications.


 describes behaviour of how HyperFastCgi will listen and proceed incoming requests. Currently there are two listeners, which process FastCgi requests, but one can write it's own to process HTTP requests, for example. 

  • type
    attribute. Fully-qualified CLR type name. There are two predefined types
    • NativeListener is a FastCgi libevent-based listener written in unmanaged code. It provides faster request processing time and allows you to use multithreading or single-threading request processing (like Node.Js)
    • ManagedFastCgiListener is a FastCgi listener written in asynchroneous sockets managed code. It works slower and can't process requests in Node.Js-like single-threading style, but if you don't want to deal with unmanaged code at all it can be a solution.
  •  element. Transport which sends requests from listener to app host. See transports section for more details.
    • type
      attribute. Fully-quilified CLR type name. There are two predefined listeners transports, which can be used with managed listener (NativeListener has it's own in native code and does not require to define listener transport)
      • HyperFastCgi.Transports.ManagedFastCgiListenerTransport
        - listener transport was written in managed code. It uses cross-domain calls when working with
        . Cross-domain calls in mono are very slow, so use this transport only if you don't need good performance or want to deal with managed code only.
      • HyperFastCgi.Transports.CombinedFastCgiListenerTransport
        - this transport uses native calls to pass data fast to another domain. Speed of calls are similar to speed of calls to the methods located in one domain.
  •  element. Transport which recieves requests in the application host and sends response from it to listener. 
    • type
      attribute. Fully-quilified CLR type name. There are three predefined apphost transport.
      • HyperFastCgi.Transports.ManagedAppHostTransport
        must be used in pair with
        for managed listener.
      • HyperFastCgi.Transports.CombinedAppHostTransport
        must be used in pair with
        for managed listener.
      • HyperFastCgi.Transports.NativeTransport
        must be used with NativeListener only.
    •  element. Defines how requests will be processed in multithreading. Can hold one of three values: 
      uses ThreadPool.QueueUserWorkItem method for processing requests,
      uses TPL, and
      processes requests directly. Default is
  •  element. Defines which protocol will be used for opening sockets. Allowed values 
    for IPv4,
    for IPv6 and
    for unix file sockets.
  • element. Defines the address on which will listen to. For unix-sockets it's a path to file.
  •  element. Defines the port on which will listen to. Is not used for unix sockets.


 defines how requests in web application will be processed. HyperFastCgi has two apphosts: AspNet for running ASP.NET applications and Raw for directly working with HTTP request data.

  • type
    attribute. Fully-qualified CLR type name. There are two types:
    • HyperFastCgi.AppHosts.AspNet.AspNetApplicationHost
      hosts standard ASP.NET sites using System.Web.
    • HyperFastCgi.AppHosts.Raw.RawHost
      provides methods for working with raw request - headers and data. It much faster than ASP.NET host (~2.5x-3.5x) but requires low-level manipulating request data. How to write web-application which works with RawHost see in the "Writing RawHost Application" chapter
  •  element. 
    attribute. Defines log level in AppHost. There are
    values. *
    attribute. Defines when logger must write debug info to console. Allowed values are
  •  element. Allowed values 
    . Adds trailing slash if path to directory does not end with '/'. Default is 'false'. This option were added for compatibility with mono-fastcgi-server. For performance reasons it's recommended to use nginx 'rewrite' command instead, i. e.
    rewrite ^([^.]*[^/])$ $1/ permanent;
  •  element. Used only by RawHost. User-defined fully-qualified CLR type name which will be used for processing requests. See "Writing RawHost Application" chapter. 


 represents collection of 
 elements each of them defines web application will be hosted by the server.

 element. Provides name of the web application. Is not used yet.
 element. Host name of virtual host. For example:
 element. Port of virtual host.
 element. Virtual path to the host. Generally 
 element. Physical path to the host files location. For example, 

Nginx configuration

See the wiki page for examples of how to configure Nginx

Writing RawHost Application

HyperFastCgi allows your to write fast web-request processing routines using C#. To do it you should do the following steps

  1. Create new C# library project and add HyperFastCgi as reference to the project.
  2. Create your own class derived from the class HyperFastCgi.AppHosts.Raw.BaseRawRequest.
  3. Override method Process and write here your own logic. See the sample

    public class HelloWorldRequest : BaseRawRequest
        public override void Process(IWebResponse response)
            Status = 200;
            StatusDescription = "OK";
            ResponseHeaders.Add("Content-Type","text/html; charset=utf-8");
            response.Send(Encoding.ASCII.GetBytes("Hello, World!"));
            response.CompleteResponse ();
  4. Get the

    and replace
     element value with the type name of your class. You should get something like this 
    YourNameSpace.HelloWorldRequest, YourAssemblyName 
  5. You're possible have to place your assembly into the GAC or put it under

    folder of your web-application, otherwise web-server won't find it. If your web application is located under
    you should place the assembly to

Package Build Recipe Using FPM-Cookery

Here is a fpm build recipe for HyperFastCgi

Additional Info

For more information read the blog

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.