Creating microservice using .NET core

Anandhan Suruli
2 min readJan 24, 2020

--

Today, I want to share how to create microservice using Microsoft .NET core.

What is Microservice?

Microservice” is a new term on the crowded streets of software architecture, A microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery.

The only pre-requisites to start creating microservice are

  1. Visual Studio Code, You can download it here
  2. .NET Core SDK, You can download it here
  3. Check installed .NET Core version on your machine, type the below command in your terminal

dotnet — version

Create a sample microservice

  1. Open your terminal and run the below command.

dotnet new webapi — name sample-microservice

You will get the below result of the above execution.

2. Open your Visual Studio Code editor

3. Go to File -> Open Folder (Select your application folder)

Now you will be able to see the project structure

4. Now you are going to build and run your sample-microservice using the below commands in your terminal

cd sample-microservice

dotnet build

The output looks like below.

5. Run your sample-microservice application

dotnet run

The output looks like below.

Your application is running and you can check using this URL https://localhost:5001/WeatherForecast

--

--

Anandhan Suruli
Anandhan Suruli

Written by Anandhan Suruli

Programer, accomplished explorer, photographer, and The writer.

No responses yet