This repository demonstrates a sample .NET solution using Dapr for service-to-service communication.
It contains two projects under one solution:
OrderService– Sends requests toTransactionService.TransactionService– Receives requests and maintains a list of transaction codes.
This setup uses Dapr sidecars to handle service to service invocation without caring the tight dependencies between them.
- .NET 8 SDK or later
- Dapr CLI
- Docker Desktop (for Dapr sidecars)
- Git (for version control)
- Open powershell
powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"- If installation fails try executing below command and install dapr cli again (skip if download is successful)
Powershell permission : Set-ExecutionPolicy RemoteSigned -Scope CurrentUserdapr -h- Open command prompt as admin
dapr initdapr --version- Clone the repository:
git clone https://github.com/thushar-p/daprsolution-example.git- Open terminal in project folder
- Run this cmd
dapr run --app-port 8080 --app-id transaction --app-protocol http --dapr-http-port 8081 -- dotnet run- Run swagger with localhost:8080/swagger
- Open terminal in project folder
- Run this cmd
dapr run --app-port 7000 --app-id order --app-protocol http --dapr-http-port 7001 -- dotnet run- Run swagger with localhost:7000/swagger