
 July 23, 2018 08:57 by 
 Peter
 PeterI 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.
 
- Collection of loosely coupled services
- 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
- var microService = new MicroService(<<port>>);  
- 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. 
 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.


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.
HostForLIFE.eu ASP.NET Core 2.2.1 Hosting
European   best, cheap and reliable ASP.NET hosting with instant activation.   HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European   Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and   Performace. HostForLIFE.eu security team is constantly monitoring the   entire network for unusual behaviour. We deliver hosting solution   including Shared hosting, Cloud hosting, Reseller hosting, Dedicated   Servers, and IT as Service for companies of all size.
 
