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
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": "http://json.schemastore.org/launchsettings.json",
"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:
<Endpoints>
<Endpoint Name="GuestExecProjectTypeEndpoint" Protocol="http" Type="Input" Port="5000" />
</Endpoints>
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:
Reference: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-deploy-existing-app
https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-guest-executables-introduction
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.