Introduction
In the first article of this series, we had a brief overview of Microservices architecture and Azure Service Fabric. Then, in the second article, we explored different programming models for Azure Service Fabric. We had a walkthrough of Reliable Services, Reliable Actors, Guest Executables, Containers and ASP.NET Core models for Service Fabric. In the third article, we had a good understanding of a couple of basic concepts in the Azure Service Fabric world like Clusters, Partitions, Replicas, and Instances. In the fourth article, we created a Reliable Services Stateless Service Fabric application using Visual Studio and hosted it in the local Service Fabric Cluster Manager. Below are the links for the previous articles in this series. As a prerequisite, it would be a good idea to go through these articles before proceeding ahead here.
- Azure Service Fabric - Introduction To Microservices And Azure Service Fabric - Part One
- Azure Service Fabric - Supported Programming Models - Part Two
- Azure Service Fabric - Understanding Cluster, Replicas, Instances, And Partitions - Part Three
- Azure Service Fabric - Building A Stateless Reliable Service - Part Four
In this article, we will deep dive into the Stateless Reliable Service that we created in the last article.
Codebase Walkthrough
When we created the application in Visual Studio, two projects got created as we can see in the Solution Explorer.

ReliableServicesStatelessDemo project manages all the operational aspects of the application. This can be treated as the project that supports the hosting infrastructure for the Service Fabric application. All configurational aspects like the number of nodes, instances, and other essential configurations are managed here. The deployment to the cluster is facilitated using a PowerShell script that got auto generated when created this application. Developers can incorporate all operational aspects here.
StatelessServiceForDemo is the actual Service Fabric project. It has the entry point to the application and the Web API controller for the Service Fabric. Developers need to focus to incorporate their requirements.
Understanding ReliableServicesStatelessDemo project
As we discussed in the previous section this project handles all operational aspects of the application. Let us get deep into this project.

This entire source code is structured in four folders - ApplicationPackageRoot ,ApplicationParameters, PublishProfiles, Scripts.
ApplicationPackageRoot contains the manifest file for the application named as ApplicationManifest.xml. All necessary configurations are defined. This manifest file has a parameters section where the default parameters are defined. However, the values for these parameters get overridden by the values from the parameters file in the ApplicationParameters folder.
- <Parameters>
- <Parameter Name="StatelessServiceForDemo_ASPNETCORE_ENVIRONMENT" DefaultValue="" />
- <Parameter Name="StatelessServiceForDemo_InstanceCount" DefaultValue="-1" />
- </Parameters>
Instance count is configured in the Service section. Name in the Service tag specifies the name of the Service Fabric application.
- <Service Name="StatelessServiceForDemo" ServicePackageActivationMode="ExclusiveProcess">
- <StatelessService ServiceTypeName="StatelessServiceForDemoType" InstanceCount="[StatelessServiceForDemo_InstanceCount]">
- <SingletonPartition />
- </StatelessService>
- </Service>
ApplicationParameters folder contains the parameter files. There are three parameters file – Cloud.xml, Local.1Node.xml and Local.5Node.xml. One of these parameter file can be loaded in the service fabric cluster. The parameter values specified here gets applied in the manifest file in the ApplicationPackageRoot folder. Let us examine one of these parameter file.


Join the conversation! Your thoughts help the community grow.