Every .NET microservices project hits the same 5 problems
Most teams pull in 5 different libraries to solve them
There is a better way.
I rebuilt a hotel booking system with 4 microservices last week.
In a typical setup I would need:
→ MassTransit for messaging
→ Polly for retries
→ Refit HttpClient for service calls
→ A Vault client for secrets
→ A Redis SDK for caching and locks
Five SDKs.
Five config styles.
Five mental models.
Instead, I used Dapr - one runtime, one client, one consistent API.
Here are the 5 problems and how Dapr solves each:
𝟭. 𝗦𝗲𝗿𝘃𝗶𝗰𝗲-𝘁𝗼-𝘀𝗲𝗿𝘃𝗶𝗰𝗲 𝗰𝗮𝗹𝗹𝘀
You reference services by App ID instead of URLs.
𝚊𝚠𝚊𝚒𝚝 𝚍𝚊𝚙𝚛𝙲𝚕𝚒𝚎𝚗𝚝.𝙸𝚗𝚟𝚘𝚔𝚎𝙼𝚎𝚝𝚑𝚘𝚍𝙰𝚜𝚢𝚗𝚌("𝚑𝚘𝚝𝚎𝚕𝚜-𝚊𝚙𝚒", "𝚛𝚘𝚘𝚖𝚜/𝚊𝚟𝚊𝚒𝚕𝚊𝚋𝚕𝚎");
Dapr handles service discovery, retries, and tracing.
No hardcoded URLs anywhere.
𝟮. 𝗔𝘀𝘆𝗻𝗰 𝗲𝘃𝗲𝗻𝘁𝘀
Publish events with one line:
𝚊𝚠𝚊𝚒𝚝 𝚍𝚊𝚙𝚛𝙲𝚕𝚒𝚎𝚗𝚝.𝙿𝚞𝚋𝚕𝚒𝚜𝚑𝙴𝚟𝚎𝚗𝚝𝙰𝚜𝚢𝚗𝚌("𝚙𝚞𝚋𝚜𝚞𝚋", "𝚋𝚘𝚘𝚔𝚒𝚗𝚐-𝚌𝚛𝚎𝚊𝚝𝚎𝚍", 𝚎𝚟𝚝);
Subscribers handle them via the [Topic] attribute.
No more BackgroundService boilerplate code.
𝟯. 𝗦𝘁𝗮𝘁𝗲 𝗮𝗻𝗱 𝗰𝗮𝗰𝗵𝗶𝗻𝗴
Key/value storage with pluggable backends:
𝚊𝚠𝚊𝚒𝚝 𝚍𝚊𝚙𝚛𝙲𝚕𝚒𝚎𝚗𝚝.𝚂𝚊𝚟𝚎𝚂𝚝𝚊𝚝𝚎𝙰𝚜𝚢𝚗𝚌("𝚜𝚝𝚊𝚝𝚎𝚜𝚝𝚘𝚛𝚎", 𝚔𝚎𝚢, 𝚟𝚊𝚕𝚞𝚎);
↳ Want TTL? Pass metadata.
↳ Want optimistic locking? Use ETags.
↳ Backend can be Redis, PostgreSQL, or Cosmos DB.
𝟰. 𝗦𝗲𝗰𝗿𝗲𝘁𝘀 𝗺𝗮𝗻𝗮𝗴𝗲𝗺𝗲𝗻𝘁
No more credentials in appsettings:
𝚟𝚊𝚛 𝚜𝚎𝚌𝚛𝚎𝚝𝚜 = 𝚊𝚠𝚊𝚒𝚝 𝚍𝚊𝚙𝚛𝙲𝚕𝚒𝚎𝚗𝚝.𝙶𝚎𝚝𝚂𝚎𝚌𝚛𝚎𝚝𝙰𝚜𝚢𝚗𝚌("𝚜𝚎𝚌𝚛𝚎𝚝𝚜𝚝𝚘𝚛𝚎", "𝚙𝚊𝚢𝚖𝚎𝚗𝚝-𝚐𝚊𝚝𝚎𝚠𝚊𝚢");
Backend can be Azure Key Vault, AWS Secrets Manager, or HashiCorp Vault.
Application code stays identical across environments.
𝟱. 𝗗𝗶𝘀𝘁𝗿𝗶𝗯𝘂𝘁𝗲𝗱 𝗹𝗼𝗰𝗸𝘀
Mutual exclusion across service instances:
𝚟𝚊𝚛 𝚕𝚘𝚌𝚔𝚁𝚎𝚜𝚙𝚘𝚗𝚜𝚎 = 𝚊𝚠𝚊𝚒𝚝 𝚍𝚊𝚙𝚛𝙲𝚕𝚒𝚎𝚗𝚝.𝙻𝚘𝚌𝚔("𝚜𝚝𝚊𝚝𝚎𝚜𝚝𝚘𝚛𝚎", "𝚛𝚘𝚘𝚖-𝟷𝟶𝟷", "𝚘𝚠𝚗𝚎𝚛", 𝟹𝟶);
Safely reserve a room when 3 service instances race for it.
The killer feature is what ties them all together.
Every name (pubsub, statestore, secretstore) maps to a YAML component file. Switch RabbitMQ to Kafka by editing one file.
Application code never changes.
I wrote a full hands-on guide with the complete hotel booking implementation:
→ Sidecar architecture explained
→ AppHost setup with .NET Aspire 13
→ Pub/sub between Bookings and Payments
→ Service invocation between Bookings and Hotels
→ State management for room availability caching
→ The DaprConstants pattern I use across all services
📌 Read the full guide here:
↳
antondevtips.com/blog/gettin…
——
♻️ Repost to help other .NET developers build cloud-native systems
➕ Follow me (
@AntonMartyniuk ) to improve your .NET and Architecture Skills