This article helps you to Deploy an existing Asp.net 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
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.
Choose the Guest Executable template. Under the Code Package Folder, browse to previously published directory of service.
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.
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.
Click on Create.
If your Service needs an endpoint for communication, you can now add the protocol, port, and type to the ServiceManifest.xml