Book Image

ServiceStack 4 Cookbook

Book Image

ServiceStack 4 Cookbook

Overview of this book

Table of Contents (18 chapters)
ServiceStack 4 Cookbook
About the Authors
About the Reviewers

Hosting services from different assemblies

The output of a .NET project is typically an assembly. This applies to ServiceStack projects also. These assemblies can be in the form of a DLL, which could be used by other programs or by a program itself. In this example, we'll show how you can create and reuse assemblies.

In this example, we'll take the ReidsonMessenger service we've been creating, refactor it a bit to be more modular, and then create a new project to host it.

Getting ready

When we last left off with the ReidsonMessenger service, it had the following structure:

We'll refactor the solution by moving MessengerService out to its own project, which will leave only the hosting details, AppHost and Global.asax, in the main project. Then, we'll create an entirely new solution that hosts the messenger in a console project instead of IIS and add the MessengerService.ServiceModel and MessengerService.ServiceInterface DLLs to it as references.

How to do it…

Right-click on the solution and choose...