This article is contributed. See the original author and article here.

This article helps you to Deploy an existing Core Web API project as Guest executable to Service Fabric Cluster.


Step 1: Publish Asp.Net Core Application to Folder.


Right-click the .NET Core project and click Publish.

Create a custom publish target and name it appropriately to describe the final published service.



You have now published the service to a directory.

Go to the path where Project is published, you will see an exe created for your project.



Step 2: Creating a Guest Service Fabric Application

  1. Choose File -> New Project and Create a Service Fabric Application. The template can be found under Visual C# -> Cloud. Choose an appropriate project name as this will reflect the name of the application that is deployed on the Cluster.

  2. Choose the Guest Executable template. Under the Code Package Folder, browse to previously published directory of service.

  3. Under Code Package Behavior you can specify either Add link to external folder or Copy folder contents to Project. You can use the linked folders which will enable you to update the guest executable in its source as a part of the application package build.

  4. Choose the Program that needs to run as service and specify the arguments and working directory if they are different. In below example we are using Code Package.

  5. Click on Create.


If your Service needs an endpoint for communication, you can now add the protocol, port, and type to the ServiceManifest.xml

For example:

 <Endpoint Protocol=”http” Name=”AccountServiceEndpoint” Type=”Input” Port=”5000″ />


The Application Url and Port can be verified from launchSettings.json of your Asp.Net Core Web API project.

Sample for reference:


  “iisSettings”: {

    “windowsAuthentication”: false,

    “anonymousAuthentication”: true,

    “iisExpress”: {

      “applicationUrl”: “http://localhost:62871“,

      “sslPort”: 0



  “$schema”: ““,

  “profiles”: {

    “IIS Express”: {

      “commandName”: “IISExpress”,

      “launchBrowser”: true,

      “launchUrl”: “weatherforecast”,

      “environmentVariables”: {

        “ASPNETCORE_ENVIRONMENT”: “Development”



    “webapi2”: {

      “commandName”: “Project”,

      “launchBrowser”: true,

      “launchUrl”: “weatherforecast”,

      “environmentVariables”: {

        “ASPNETCORE_ENVIRONMENT”: “Development”


      “applicationUrl”: “https://localhost:5001;http://localhost:5000




Service Manifest file:


      <Endpoint Name=”GuestExecProjectTypeEndpoint” Protocol=”http” Type=”Input” Port=”5000″ />



Now, you are set to deploy the Guest Executable Project to Service Fabric cluster.


Step 3: Deploy the Guest Application to Azure Service Fabric cluster


From SFX: 



Step 4: Accessing the Web API from Cluster Node

RDP inside the node and Hit the API endpoint.

Eg:  http://localhost:5000/weatherforecast



In case you are not sure, in which port application is listening, please find an alternative way to check:

If deployed in Azure:

  • RDP inside the node and get the Process ID of exe.

  • Run netstat -ano






Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.