<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices-mpwi8kfwk" -->

---
title: Strangler Fig Pattern in C#: Refactoring a Monolith to...
description: A step-by-step guide to applying the Strangler Fig pattern in C# and .NET to incrementally migrate a monolithic ASP.NET Core application to microservices. The...
canonical: https://daily.dev/posts/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices-mpwi8kfwk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Strangler Fig Pattern in C#: Refactoring a Monolith to Microservices | daily.dev
og:description: A step-by-step guide to applying the Strangler Fig pattern in C# and .NET to incrementally migrate a monolithic ASP.NET Core application to microservices. The...
og:url: https://daily.dev/posts/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices-mpwi8kfwk
og:image: https://api.daily.dev/og/posts/mPWI8kfwk.png
og:image:alt: Strangler Fig Pattern in C#: Refactoring a Monolith to Microservices
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Strangler Fig Pattern in C#: Refactoring a Monolith to Microservices

**[We Are .NET](https://daily.dev/sources/wearedotnet)** · 16 min read · 12 upvotes · 1 comments

## Summary

A step-by-step guide to applying the Strangler Fig pattern in C# and .NET to incrementally migrate a monolithic ASP.NET Core application to microservices. The guide covers a three-stage process: starting with a monolith sharing a single database across Products, Orders, and Customers domains; extracting Products into its own service with an isolated database; and introducing a YARP reverse proxy as a strangler facade that transparently routes traffic to the new service while the monolith handles the rest. Full runnable code is provided for each stage. The guide also covers common pitfalls (shared databases, synchronous dependency chains, skipping the facade) and scenarios where the pattern is inappropriate (small codebases, teams lacking operational maturity, tight transactional coupling between domains).

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.devleader.ca/2026/07/24/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices>

## Questions this post answers

### How do I use YARP to implement the strangler fig pattern in a .NET migration?

YARP acts as the strangler facade, a reverse proxy sitting in front of both the legacy monolith and newly extracted services. It's configured in appsettings.json with routes matched by path pattern (e.g. /products/{**catch-all}) mapped to clusters, so requests for migrated domains go to the new service while everything else falls through to the legacy app based on route priority ordering.

_daily.dev surfaces practical YARP and .NET migration guides for teams planning a strangler fig rollout._

### What is the biggest mistake teams make when extracting a microservice from a monolith?

Sharing the same database between the monolith and the newly extracted service is the biggest trap, because it preserves coupling at the data layer even though the code has moved. Each extracted service must own its own database schema and DbContext; other common pitfalls include synchronous dependency chains between services, extracting a domain before understanding its true boundaries, and skipping the routing facade entirely.

_Track real-world migration pitfalls like these on daily.dev before starting a monolith extraction._

### How do I decide which domain to extract first when breaking apart a monolith?

Start with the domain that has the highest internal cohesion and lowest coupling to other domains, meaning it doesn't need synchronous calls or shared transactions with other parts of the system. In a typical e-commerce monolith, a Products domain is a strong first candidate because it doesn't depend on Orders or Customers, making it self-contained enough to extract safely first.

_daily.dev helps engineers weighing microservice extraction order compare real migration experiences._

## Community discussion

Top comments from developers on daily.dev.

**@ajaychoudhary80** · 0 upvotes

> The biggest challenge is usually defining the right service boundaries, not writing the code.

## Similar posts on daily.dev

- [The strangler fig pattern: modernizing without a big-bang rewrite](https://daily.dev/posts/the-strangler-fig-pattern-modernizing-without-a-big-bang-rewrite-bji9lixdt) · Netguru · 35 upvotes · 6 comments
- [How to Move from Monolith to a Service Based Architecture](https://daily.dev/posts/how-to-move-from-monolith-to-a-service-based-architecture-8wr0lttmy) · System Design Codex · 74 upvotes · 3 comments
- [Repay Tech Debt with the Strangler Fig Pattern](https://daily.dev/posts/repay-tech-debt-with-the-strangler-fig-pattern-z57wnfd3i) · RUBYLAND · 2 upvotes · 4 comments
- [Monolith to Service Architecture](https://daily.dev/posts/monolith-to-service-architecture-2izyvqort) · System Design Codex · 102 upvotes · 4 comments

---

Tags: [#microservices](https://daily.dev/tags/microservices), [#c#](https://daily.dev/tags/c#)

[View this post on daily.dev](https://daily.dev/posts/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices-mpwi8kfwk)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Strangler Fig Pattern in C#: Refactoring a Monolith to Microservices","url":"https://daily.dev/posts/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices-mpwi8kfwk","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices-mpwi8kfwk"},"datePublished":"2026-07-24T14:31:48.859Z","dateModified":"2026-09-14T09:06:07.466Z","description":"A step-by-step guide to applying the Strangler Fig pattern in C# and .NET to incrementally migrate a monolithic ASP.NET Core application to microservices. The...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/58222509023f8cb8dd1b9df42aa516b8?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/58222509023f8cb8dd1b9df42aa516b8?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"We Are .NET","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"We Are .NET","logo":"https://media.daily.dev/image/upload/s--BsnVOa3i--/f_auto/v1718347410/logos/wearedotnet","url":"https://daily.dev/sources/wearedotnet"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices-mpwi8kfwk","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":12},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"microservices,c#","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"We Are .NET","item":"https://daily.dev/sources/wearedotnet"},{"@type":"ListItem","position":3,"name":"Strangler Fig Pattern in C#: Refactoring a Monolith to Microservices"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices-mpwi8kfwk","comment":[{"@type":"Comment","text":"The biggest challenge is usually defining the right service boundaries, not writing the code.","datePublished":"2026-07-28T06:08:19.852Z","url":"https://daily.dev/posts/mPWI8kfwk#c-zxdcPNsRz","author":{"@type":"Person","name":"Ajay Choudhary","url":"https://daily.dev/ajaychoudhary80","image":"https://media.daily.dev/image/upload/s--WkX8wDW2--/f_auto/v1780989706/avatars/avatar_QNZlI2SgVnNSx5PSRpCVx?_a=BAMAMiWQ0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/strangler-fig-pattern-in-c-refactoring-a-monolith-to-microservices-mpwi8kfwk#faq","mainEntity":[{"@type":"Question","name":"How do I use YARP to implement the strangler fig pattern in a .NET migration?","acceptedAnswer":{"@type":"Answer","text":"YARP acts as the strangler facade, a reverse proxy sitting in front of both the legacy monolith and newly extracted services. It's configured in appsettings.json with routes matched by path pattern (e.g. /products/{**catch-all}) mapped to clusters, so requests for migrated domains go to the new service while everything else falls through to the legacy app based on route priority ordering. daily.dev surfaces practical YARP and .NET migration guides for teams planning a strangler fig rollout."}},{"@type":"Question","name":"What is the biggest mistake teams make when extracting a microservice from a monolith?","acceptedAnswer":{"@type":"Answer","text":"Sharing the same database between the monolith and the newly extracted service is the biggest trap, because it preserves coupling at the data layer even though the code has moved. Each extracted service must own its own database schema and DbContext; other common pitfalls include synchronous dependency chains between services, extracting a domain before understanding its true boundaries, and skipping the routing facade entirely. Track real-world migration pitfalls like these on daily.dev before starting a monolith extraction."}},{"@type":"Question","name":"How do I decide which domain to extract first when breaking apart a monolith?","acceptedAnswer":{"@type":"Answer","text":"Start with the domain that has the highest internal cohesion and lowest coupling to other domains, meaning it doesn't need synchronous calls or shared transactions with other parts of the system. In a typical e-commerce monolith, a Products domain is a strong first candidate because it doesn't depend on Orders or Customers, making it self-contained enough to extract safely first. daily.dev helps engineers weighing microservice extraction order compare real migration experiences."}}]}
```

