29

How to build micro service oriented application in .NET world? Are there any platforms where we can write micro service oriented apps in .NET world? How to envision architecture that includes Micro services, Event store and some of NoSQL databases? Thanks.

Yves M.
  • 29,855
  • 23
  • 108
  • 144
netdeveloper62
  • 351
  • 1
  • 3
  • 5
  • 1
    Toooo late but incase if it helps someone. Try [Microsevices with Containers by Microsoft](https://blogs.msdn.microsoft.com/cesardelatorre/2017/05/10/free-ebookguide-on-net-microservices-architecture-for-containerized-net-applications/). They have created a sample app with microservices and MVC/Angular2/Xamarin front-ends and a book to guide you through. – Alpesh Jul 05 '17 at 11:44

5 Answers5

15

Follow this link for a step-by-step guide to setting up a simple Microservice framework using the .NET framework, ASP.NET, and RabbitMQ.

The tutorial starts with the core concepts, implements a working application, and scales that application in terms of size and complexity, tackling typical Microservice problems during each step.

Paul Mooney
  • 1,576
  • 12
  • 28
12

Microservices is more an architectural approach than framework or a set of libraries. But in .Net world you can create independent process for web services using the OWIN (Open Web Interface for .NET).

You can see an example for implementing a self hosting web service (it do not requires IIS) in:

http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api

With that, you can implement your microservices like self-hosting services in one or more machines. The kind of database or event source is up to your application.

Then you can build some API Rest queried by your application, used like a central point of acces, a Facade pattern, every request will be turned to one of your minions-microservices.

Fidel Orozco
  • 998
  • 11
  • 19
  • 1
    Doesn't the central REST API like the one you mention introduce a central point of failure? (This is the last part of Microservices I'm having trouble understanding, how are they called?) – Cameron Wilby Dec 02 '16 at 01:00
  • 2
    @CameronWilby Yes,it could be a central point of failure if you do not have redundancy. But you could set multiple IP addresses in your DNS Server pointing to different server instances holding the API REST. Setting some kind of round robin or load balance is posible. Using the the Internet best practices is something you must apply to your microservice app to make it more robust if it is your need. – Fidel Orozco Dec 14 '16 at 19:53
  • Are there any security concerns using API versus something like RabbitMQ (which other people are suggesting)? – codeMonkey Mar 21 '17 at 16:04
  • 1
    @codeMonkey certainly you must provide some security mechanism to your REST API (Ex. Https, or signing the requests with something like HMAC could be a good practice). But even with messaging o event based solutions like RabbitMQ the security is a consideration. – Fidel Orozco Apr 20 '17 at 02:20
  • @FidelOrozco Do you have an example for signing requests? – Anil Vangari Oct 25 '17 at 01:52
  • @AnilVangari You can refer to signing requests with HMAC in http://acaasia.blogspot.mx/2013/04/designing-secure-rest-web-api-without.html and a code sample in http://billatnapier.com/security01.aspx – Fidel Orozco Oct 27 '17 at 17:03
10

Microsoft have released Service Fabric which gives you a platform for Microservices.

It is an Azure offering but will also be available on-premise with Windows Server 2016.

You can install Service Fabric on a dev machine running VS2015 and try it out using the SDK.

iandayman
  • 4,357
  • 31
  • 38
3

Please have a look at. Please note that this is a hot topic and things are changing daily. Right now the core movement on micro-services is happening mostly in Java world.

http://blog.pivotal.io/pivotal/case-studies-2/tech-start-up-lessons-micro-services-architecture-with-net-and-rabbitmq

http://abdullin.com/post/how-micro-services-approach-worked-out-in-production/

Marcin Waligora
  • 548
  • 4
  • 11
3

Since the protocol of choice when working with microservices is HTTP, I would recommend .NET Web API for the API layer. Since microservices respect the 4 tenants of SOA, you will want to make sure that every service has its own data storage and that every "service" can be deployed independent. I would say that the most import aspect when setting up an architecture is related to the API contracts, because every service can have it's own implementation.

.NET Web API + NServiceBusdo provide a nice foundation for an architecture based on microservices.

MeTitus
  • 3,390
  • 2
  • 25
  • 49