Quick Micro Services Development Using MicroService4Net (No Containers)

Here, we are showing how we can quickly develop ASP.NET MVC WEB API based Microservices without any containers, but using Open Web Interface(OWIN)

I won't be discussing Microservices here because I specifically need to focus on the subject of interest and that shouldn't be diluted. So, the focus area is developing Microservices without the usual containers, like docker etc., but  rather using the existing tools and technologies that belong to ASP.NET. We are targeting the below characteristics of Microservices in this article.
  1. Collection of loosely coupled services
  2. Services with isolated context and so can freely deploy.
Now, let us get an idea of the below terminologies. 
 
Open Web Interface for .NET

It's a middleware technology, http://owin.org/, and widely using in ASP.NET MVC Web API to enable self-hosting. You need an idea of OWIN before proceeding here.
 
MicroService4Net

It's a wrapper made on top of OWIN to make Microservice development more easy. You are able to create self hosting loosely coupled services without even the need of web servers like IIS. 
 
Two sample projects I uploaded here do simple mathematics of Addition and Multiplication. Here, I have created 2 separate services for each of these operations and you can call them independently. I also made them self hosting without even need of a web server.
 
You may be interested in the below-mentioned code.
 
Run Services using MicroService4Net
  1. var microService = new MicroService(<<port>>);  
  2. microService.Run(args);  
It's self explanatory how to create an instance of MicroService by passing an available port. Then, call microService.Run(args);. Now your service is running. It's that simple! Any MVC controllers defined in your service project can be accessed. Below are my 2 services created for Add and Multiply, they are running on different ports and also in their own context rather than sharing a common context of IIS etc. Here, a console application is basically doing the hosting using OWIN technology.
 
.NET 
 
 As you can see here, hosting has been inside console applications, you can later register it as a Windows Service though. I will  be able to access my both services through browsers. See below.
 
.NET  
 .NET
 
So now, we have loosely coupled services running without any web server dependency. The technology is OWIN and the tool MicroService4Net made it easy to crack the Microservice part of it. I uploaded 2 projects, and each belongs to these 2 services. You can refer to it and then try to resolve one use case I mentioned below.
 
Use Case to Resolve

A Microservice deployment may contain 100s or 1000s or even more small services and each has its own boundary scope. In a practical scenario, no one wants to run all services 24/7. But what people do, whenever an API of a service has been called, then that service will go up and after execution service will go off again. So services run on demand and as our host is a console application, it seems easy. There are many ways to solve this scenario.