You will have to install and set up a local Service Fabric cluster on your PC before you can create and test Service Fabric applications.
Getting ready
We will download and install the software development kit (SDK) from the Azure site. This will allow us to create a local Service Fabric cluster on your local development machine.
You will need to accept the license terms before the installation begins:
The web platform installer then starts downloading the Microsoft Azure Service Fabric runtime. Allow this process to complete:
After the download has completed, the install process will begin:
When the installation has completed, the following products would have been installed, which is also evident in the following screenshot:
Microsoft Azure Service Fabric Runtime
Microsoft Azure Service Fabric Core SDK Preview
Microsoft Azure Service Fabric Visual Studio 2015 Tools Preview
Microsoft Azure Service Fabric SDK Preview
The next task is to open PowerShell as the administrator. In the Windows 10 Start menu, type the word PowerShell, and the search will immediately return the desktop application as a result. Right-click on the desktop application and select Run as administrator from the context menu:
Once Windows PowerShell has opened up, run the Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser command. The reason for this is that Service Fabric uses PowerShell scripts for the creation of the local development cluster. It is also used for the deployment of Visual Studio developed apps. Running this command prevents Windows from blocking those scripts:
Next, create the local Service Fabric cluster. Enter the & "$ENV:ProgramFilesMicrosoft SDKsService FabricClusterSetupDevClusterSetup.ps1" command.
This will create the local cluster needed to host Service Fabric applications:
After the cluster is created, PowerShell will start the service:
The process might take several minutes. Be sure to let it complete:
Once the naming service is ready, you can close PowerShell:
To view the created cluster, you can navigate to http://localhost:19080/Explorer on your local machine.
This will give you a snapshot of the cluster's health and state. It will also show any applications running in the cluster:
How it works…
As you can see, the Service Fabric cluster is essential for creating and running applications created in Visual Studio. This will allow us to test applications directly on your local machine before publishing them to the cloud.