Getting Started with Azure Service Fabric

I wanted to show a simple example of using Azure Service Fabric to create a reliable & scalable micro service that would perform addition functionality on an input string for example “1+1” using a console application as the client.

The string is parsed out to two integers and calculates the result. Obviously this is extremely simplistic type of example. I wanted to really just do a quick test on passing input and expecting output.

The code is listed up on my GitHub account under the ServiceFabric Repo.

ASP.NET Core Web API with Docker

This post simply demonstrates creating a simple service called ‘AdditionMicroservice’ that adds two numbers provided as query string parameters.

I will add this code to my GitHub account under Getting started with Microservices repo

Pre-requisites:
Docker for Windows

1) Create a new ASP.NET Core Web Application project

image

Select the Web API Template

image

Check the Enable Docker Support checkbox

Select Windows as the OS

Click

Open Values Controller file under Controllers

image 

Remove all other methods except first Get method and change to below as below

image

The change  launchUrl’s from api/value to api/addition in launhsettngs.json file:

image

Run the app and append to the URL both the x and y parameters along with their set values to view the result:

image