CHAPTER 4
Solution Configuration
It’s finally time to start coding. In this chapter, we will see how to create the ServiceStack.Succinctly.Host project and enable the ServiceStack framework.
The first thing to do is to create a new solution and create a list of projects as specified in the following table.
- Project list
Visual Studio Project Name | Visual Studio Project Type |
|---|---|
ServiceStack.Succinctly.Host | ASP.NET Empty Web Application |
ServiceStack.Succinctly.ServiceInterface | Windows Class Library |
OrderManagement.Core | Windows Class Library |
OrderManagement.DataAccessLayer | Windows Class Library |
Step 1: Create a New ASP.NET Empty Web Application
Use Visual Studio to create a new ASP.NET Empty Web Application project and call it ServiceStack.Succinctly.Host.

- Creation of a new ASP.NET Empty Web Application project
Step 2: Install ServiceStack Binaries and Configure web.config
In order to run our first web service, we need to add ServiceStack as a project reference. This can be done manually or by using NuGet, which is the easiest way in my opinion.
By running the following command in Visual Studio’s Package Manager Console, the reference will be automatically added to the project:
PM> Install-Package ServiceStack |
The following packages will be installed by default:
- ServiceStack
- ServiceStack.Common
- ServiceStack.Interfaces
- ServiceStack.OrmLite
- ServiceStack.OrmLite.SqlServer
- ServiceStack.Redis
- ServiceStack.ServiceInterface
- ServiceStack.Text
Tip: If you want to mix ServiceStack with your existing ASP.NET or ASP.NET MVC applications, there are two packages that were created specifically to help you install ServiceStack automatically:
PM> Install-Package ServiceStack.Host.Mvc
PM> Install-Package ServiceStack.Host.AspNet
After adding the required binary files to the project, we need to instruct our application to use the ServiceStack HTTP handler, which will act as an entry point of the application. This is done by putting the following configuration in the web.config file.
|
<!-- Required for IIS 6.0 (and above) --> <system.web> <httpHandlers> <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> </httpHandlers> <compilation debug="true"/> </system.web> <!-- Required for IIS 7.0 --> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <handlers> <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true"/> </handlers> </system.webServer> </configuration> |
Step 3: Creating the Application Host
In order to run a ServiceStack web service, we have to start the application host when the IIS application starts. There can be only one application host per application pool and, therefore, creating multiple application hosts is not allowed. The following code represents the minimum AppHostBase implementation. The Global class refers to the Global.asax.cs file.
- Flexible data integration with REST-based APIs
- Supports various authentication methods, including basic HTTP and no authentication
- Handles diverse data formats like JSON, CSV, and XML
- Dynamic data retrieval with date parameter filtering