Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


  1. Awesome job on the article Mukesh. I always enjoy your ability to make scary topics easy to understand. Quick question, as you add more endpoints to each of your microservice, won’t the routes get harder to maintain?

    1. Hi, Thanks again.
      I am not very sure about that, as I have not worked with a highly scalable Microservice Solution. But I believe it must be possible to maintain one JSON settings file for each microservice. Would make more sense right? Will check on that


    2. i am working on a project having 8 micro services and ocelot as gateway. i use one single ocelot json file, file too lengthy now but still manageable.

      its a good idea to have separate json file for each micro service.

    1. Hi, could you please give more details.
      The working source code is linked to at the end of the article. Please do check it and let me know of the issue.

      Thanks and regards

  2. Really good article and am trying my own version following your guidance. Problem is I continue to get an error when running all parts together :

    System.InvalidOperationException: ‘A public method named ‘ConfigureDevelopment’ or ‘Configure’ could not be found in the ‘Gateway.WebAPI.Startup’ type.’

    Any thoughts??

    1. Hi, Thanks for the feedback.

      I guess you don’t have a configure() method in your startup.cs as the core Application wants it.

      Make sure you have a
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

      In your Startup.cs. This is like a mandatory method that every Application needs. Do try it and let me know.

      Thanks and regards

  3. really good article but one advance topic is unclear, how can you make the Microservices interact with each other?

  4. Hi Mukesh Sir
    I have seen many of your blogs and also studied the project. I am in last year of my B.Tech and I have cleared all the concept of the .Net core that you have done your projects and also worked in a company as a trainee for 6 months So my straight question is Can I get a average job on the basis of this knowledge?

    1. Hello Deepak,

      As for Freshers, Interviewers expect you to know the bare minimum . From my experience, you would need to be clear with OOPS, Alorithms, MVC Pattern (If you are looking for Web Developer Profile.) , Routings, Auth, mostly the basics of MVC. A bit of knowledge on CSS/Jquery is also needed (at least the syntax of js functions and so on).

      Yes, my blog articles cover the essentials in getting started with ASP.NET Core. Core is an additional knowledge that can impress your interviewers.
      All the best

  5. The gateway and service paths are not following the REST interface patterns. Strictly speaking ../gateway/product/{id} should also be used for PUT/PATCH while ../gateway/product should only be used for GET and POST.

    1. Hello, Auth in Microservices will be a whole new article. This was just the starting point to understand how Microservices work. I am planning to do a separate article on auth and communication between various microservices.

      Thanks and Regards

  6. When creating your site like this, does each microservice also implement the full Clean Architecture? I know this will result in duplication because a bunch of your base classes will be the same, but I’m assuming they still all implement clean architecture.

  7. Thanks for the article. I was really happy to see it when i opened your blog (asked you for this article some time ago).

  8. Hi,

    I would like to know how microservices handle something like db transactions. For example, In order service when I make the order I would like to add entries in my accounting service as well. But I want them to be saved both. What if one fails and the other is successful how is this handled?

  9. Hi Mukesh,

    for some reason I cannot navigate to the product micro-service via the Gateway.

    This is the url: localhost:/gateway/product

    Below is my ocelot.json file:-

    “Routes”: [
    “DownstreamPathTemplate”: “/api/product”,
    “DownstreamScheme”: “https”,
    “DownstreamHostAndPorts”: [
    “Hosts”: “localhost”,
    “Port”: 44355
    “UpstreamPathTemplate”: “/gateway/product”,
    “UpstreamHttpMethod”: [ “POST”, “PUT”, “GET” ]

    and my launchsettings json file:

    “iisSettings”: {
    “windowsAuthentication”: false,
    “anonymousAuthentication”: true,
    “iisExpress”: {
    “applicationUrl”: “http://localhost:60261”,
    “sslPort”: 44311
    “profiles”: {
    “IIS Express”: {
    “commandName”: “IISExpress”,
    “launchBrowser”: true,
    “environmentVariables”: {

    But when I navigate to “https://localhost:44311/gateway/product”
    I get

    “This localhost page can’t be found No webpage was found for the web address: https://localhost:44311/gateway/product
    HTTP ERROR 404″

    Any help would be greatly appreciated. The microservices (Product & Customer) work fine in isolation.


    1. Hi Robert,
      Let me try to respond:
      Just please check the correctness of the SSL port for the Product microservice if it is indeed 44355 (as in the ocelot.json file), as you’ve not posted the launchsettings.json code, that’s the reason I’m guessing that there could be a typo.

      Also if by mistake or intentionally. SSL port was not configured for Product, (As I found in my own project), it will show the same error.
      Hope this helps.

  10. Dear Mukesh,

    Thank you so much for very lucid and clear explanation.

    Looking forward to more topics like SAGA pattern in microservices , CQRS practical implementation.

  11. Hi, Mukesh.

    Firstly, thanks for the great article. Don’t you think that it will be difficult to maintain all routes in huge projects? I wonder if there any way not to register all endpoints one-by-one. For example, for each request just change the base URL to the appropriate microservice URl?

  12. Awesome job on the article Mukesh, But I can see about your mistake with ocelot.json
    I think with the code below it’s wrong when you set method “PUT”

    “UpstreamPathTemplate”: “/gateway/product”,
    “UpstreamHttpMethod”: [ “POST”, “PUT”, “GET” ]

    Please let me know if I wrong.
    Thanks a lot.

  13. I appreciate your blogs and youre doing an awesome job so keep going dude 🙂 We’re all learning new things everyday and I hope if you were to go back and revise the sections covering the monolithic and microservices architectures you’d be able to explain the actual and real differences between the two ( Add in a modular monolith architecture concept into the mix as it’s gonna help you understand the semantics ( and the difference in architecting your codebase vs infrastructure (deployment) 🙂 Cover all of the grounds from descriptions, benefits, drawbacks, issues to decision making process, etc. Understand (and share with your audience) the Fallacies of distributed computing (

  14. Awesome article. If you show the microservices deployment with docker through CICD pipeline and separate DB for each service then it will be fantastic. Thanks

  15. This is one of the best article I read on Microservices . Thanks for your effort . Keep posting articles like these , you are helping beginners like me 🙂

  16. Hi, I always get below error (even with the downloaded source code of yours)
    localhost is currently unable to handle this request.
    HTTP ERROR 502

  17. Hi, I am able to get this working in http. So it looks like my system issue nothing to do with the code. Thank you so much for this article. great work.

  18. Awesome! guide for beginners but I can not understand how we can implement 1- many relationships. For example, we have 2 entities Blog and comment. Each blog can have multiples comments so how we are going to implement this. We will have a separate service for each entity, but how can we remove tables’ redundancy in each service’s DB? Please make a blog on this as well.

  19. Dear Mukesh
    Thanks for the article
    But my post request is not working.It gives error from postman

    Error: Invalid character in header content [“Host”]

    my ocelot json is
    “Routes”: [
    “DownstreamPathTemplate”: “/b2b/Admin”,
    “DownstreamScheme”: “http”,
    “DownstreamHostAndPorts”: [
    “Host”: “localhost”,
    “Port”: 51298
    “UpstreamPathTemplate”: “/User/Auth”,
    “UpstreamHttpMethod”: [ “POST”, “PUT”, “GET” ]
    “DownstreamPathTemplate”: “/b2b/Admin/{id}”,
    “DownstreamScheme”: “http”,
    “DownstreamHostAndPorts”: [
    “Host”: “localhost”,
    “Port”: 51298
    “UpstreamPathTemplate”: “/User/Auth/{id}”,
    “UpstreamHttpMethod”: [ “GET” ]
    “GlobalConfiguration”: {
    “BaseUrl”: “http://localhost:63983”


  20. Hey
    Thanks for sharing the knowledge , I have read your artical and created the same application and easly created and run the microservice.

  21. Thanks Mukesh, it’s an easy and detailed article on microservices. Not everyone has this talent to explain things in an easy manner unless they are very good at a particular topic.

  22. Great Article on Microservice with Asp.Net Core C#.
    Can you please explain how does microservice API Communicate with each other.

  23. Is it possible to place your code in GITHUB to down load the source code for each article so that it will be helpfull and Great.
    Thanks a lot for your useful and good stuff.

    1. you can already do that using GitHub. Just log in and clone the repo you want to download onto your machine. There is also an option to download the source code as a zip from GitHub.

  24. I am learning about microservices, I am having doubts about configuring the API gateway routes, Do we have to add up all the endpoints to the routes considering my service is having 12 API endpoints?

  25. I was beginner. I really help it with each step, how to do it and what do it.
    Explained very will step by step

  26. We have Download the code from git. when run [https://localhost:44382/api/product] we got This site can’t be reached.
    Would you please give me solution