Skip to content

Architecture overview

mythz edited this page Jul 12, 2012 · 25 revisions

Ultimately behind-the-scenes ServiceStack is just built on top of a set of Raw ASP.NET IHttpHandler's. The entry point for all ASP.NET and HttpListener requests is in the ServiceStackHttpHandlerFactory whose purpose is to return the appropriate IHttpHandler for the incoming request.

Server Architecture

ServiceStack Logical Architecture View

Client Architecture

ServiceStack's Message-based design allows us to easily support typed, generic re-usable Service Clients:

ServiceStack HTTP Client Architecture

By promoting clean, dependency-free and endpoint-ignorant Service and DTO classes we can also host your same web services on any endpoint. The client architecture with an MQ Host is enabled:

ServiceStack MQ Client Architecture

Implementation

There are 2 distinct modes in any ServiceStack application:

  1. AppHost Setup and Configuration - Only done once for all services. Run only once on App StartUp.
  2. Runtime - Run on every request: uses dependencies, plugins, etc. defined in the AppHost. Each new request re-binds all IOC dependencies to a new service instance which gets disposed at the end of each request.

The implementation of this can be visualized below:

ServiceStack Overview

After the IHttpHandler is returned, it gets executed with the current ASP.NET or HttpListener request wrapped in a common IHttpRequest instance.

The implementation of RestHandler shows what happens during a typical ServiceStack request:

ServiceStack Request Pipeline

Clone this wiki locally