In my previous C# Corner article we learned to install the Azure Service Fabric SDK and we configured a 1 node cluster locally. After that, we created a Microservice application with MVC using Service Fabric and saw how it is running in the local cluster. In this article, we will create an Azure Service Fabric Cluster with 5 nodes using the Azure Portal and we will deploy our existing ASP.NET Core application in this cluster.
Azure Service Fabric is a distributed systems platform which makes it easy to package, deploy, and manage scalable and reliable microservices and containers. Please refer to this URL to get the basic idea about Azure Service Fabric.



After choosing the VM count, you can click the OK button to proceed.
We can create a Key vault for security purpose. This key vault and Certificate will be used later.







After downloading the certificate please come to the previous page and click the “Create” button to create our Service Fabric Cluster.




Cluster deployment will be finished soon. You can see all the resources listed in the Azure. Please note for one cluster, there are a total of 8 resources created in Azure. 1 Public IP Address, 1 Load balancer, 1 Virtual machine scale set, 1 Key vault, 2 Storage accounts, 1 Virtual network along with our cluster.

Please note that 5 nodes are active and no application is hosted yet in this cluster.
We can open Visual Studio 2017 in Administrator mode (It is very important, we need administrator rights later for PowerShell commands) and open our existing .NET core application. (We already created a sample .NET Core application and I explained in my previous C# Corner article). We can publish the application by right-clicking the microservice project and choosing “Publish”.


It will take some time to finish the deployment.
If you go to service fabric explorer, you can see that the new application is listed there now.



- <?xml version="1.0" encoding="utf-8"?>
- <ServiceManifest Name="SarathMicroServicePkg" Version="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <ServiceTypes>
- <!-- This is the name of your ServiceType.
- This name must match the string used in RegisterServiceType call in Program.cs. -->
- <StatelessServiceType ServiceTypeName="SarathMicroServiceType" />
- </ServiceTypes>
- <!-- Code package is your service executable. -->
- <CodePackage Name="Code" Version="1.0.0">
- <EntryPoint>
- <ExeHost>
- <Program>SarathMicroService.exe</Program>
- <WorkingFolder>CodePackage</WorkingFolder>
- </ExeHost>
- </EntryPoint>
- <EnvironmentVariables>
- <EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="" />
- </EnvironmentVariables>
- </CodePackage>
- <!-- Config package is the contents of the Config directoy under PackageRoot that contains an
- independently-updateable and versioned set of custom configuration settings for your service. -->
- <ConfigPackage Name="Config" Version="1.0.0" />
- <Resources>
- <Endpoints> <!-- This endpoint is used by the communication listener to obtain the port on which to listen
- . Please note that if your service is partitioned, this port is shared with replicas of different partitions that are placed in your code. -->
- <Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input" Port="8281" />
- </Endpoints>
- </Resources>
- </ServiceManifest>



You can click the “Save” Button to apply these new port numbers to load balancer.
You can check the running application by opening in a browser. (Without https) Our application is running fine.


Avinash PhadkePosted Oct 26, 2018, 1:30 AM
Great detailed document...