In this article, we will add Web API to
service fabric application. This will be continuation to article Getting
Started with Azure Service Fabric.
Step 1: Right click on the Services, select
Add and then New Service Fabric Service.
Step 2: Select ASP.NET Core and give
Service Name of your choice and click OK.
Step 3: Now, you will get ASP.NET Core
templates, select Web API template and click Ok again.
Step 4: Your solution will have new service
Step 5: Now Run the application, make sure
your local cluster is running. Once you run the application you will get error
HTTP 404 error now found.
Add /api/values to the URL, URL should be
like this http://localhost:8567/api/values.
Port number might vary because it is randomly assigned.
The output will be ["value1","value2"] which is returned by Get method of ValuesController of WebAPI template.
This ends the article of adding ASP.NET core Web API in Azure Service Fabric.