Skip to content
Paul Mcilreavy edited this page Dec 23, 2025 · 1 revision

This guide explains how to use .NET Aspire for local development of AzureEventGridSimulator.

Prerequisites

  • .NET 10.0 SDK
  • Docker Desktop (Windows/macOS) or Docker Engine (Linux)
  • Visual Studio 2022 17.14+ or VS Code with C# DevKit

Getting Started

1. Start the Aspire AppHost

From the repository root:

cd src
dotnet run --project AzureEventGridSimulator.AppHost

This starts:

  • Azure Event Grid Simulator
  • Azurite (Azure Storage Emulator)
  • Azure Service Bus Emulator
  • Azure Event Hubs Emulator
  • SQL Server (for Service Bus Emulator)
  • Aspire Dashboard (for observability)

2. Open the Aspire Dashboard

The dashboard URL will be displayed in the console output (typically https://localhost:17157).

The dashboard provides:

  • Resources: View status of all running services
  • Console Logs: Real-time logs from all services
  • Structured Logs: Searchable structured log entries
  • Traces: Distributed traces showing request flows
  • Metrics: Performance metrics

3. Publish Events

The Event Grid Simulator will be available at the configured topic ports (e.g., https://localhost:60101).

Use the existing Postman collection or curl:

curl -X POST https://localhost:60101/api/events \
  -H "Content-Type: application/json" \
  -H "aeg-sas-key: YourKey=" \
  -d '[{"id":"1","eventType":"test","subject":"test","eventTime":"2025-01-01T00:00:00Z","data":{},"dataVersion":"1.0"}]'

4. View Traces in Dashboard

After publishing events, open the Traces tab in the Aspire dashboard to see:

  • Incoming HTTP request
  • Event parsing and validation
  • Subscriber delivery attempts
  • Retry operations (if any)

Alternative: Docker Compose

If you prefer Docker Compose over Aspire, the existing setup still works:

cd docker
docker-compose up --build

Both methods provide the same Azure emulator services. The difference is:

  • Aspire: Integrated dashboard, automatic service discovery, OpenTelemetry traces
  • Docker Compose: Traditional approach, requires manual Seq setup for logging

Configuration

Topic Configuration

Topics are configured the same way as before (appsettings.json or environment variables). The Aspire AppHost automatically passes configuration to the simulator.

Port Configuration

When running under Aspire, the simulator's ports are managed by the AppHost. To customize:

// In AppHost Program.cs
builder.AddProject<Projects.AzureEventGridSimulator>("eventgridsimulator")
    .WithHttpsEndpoint(name: "topic1", port: 60101, isProxied: false)
    .WithHttpsEndpoint(name: "topic2", port: 60102, isProxied: false);

Troubleshooting

Service Bus Emulator Crashes

If using Docker 4.33.0+ on ARM macOS, the Service Bus Emulator may crash due to azure-sql-edge compatibility. Workaround:

  • Use an earlier Docker version, or
  • Run on x64 architecture

Multi-Port Issues

If only one topic port works, ensure isProxied: false is set for all endpoints, or configure ports via Kestrel in appsettings.json.

Dashboard Not Loading

Check that the dashboard port (17157 by default) is not in use by another application.

Deployment

Aspire is only for local development. Production deployments continue using:

  • Docker image: pmcilreavy/azureeventgridsimulator:latest
  • .NET Tool: dotnet tool install -g AzureEventGridSimulator

Aspire components (AppHost, ServiceDefaults) are not included in production deployments.

Clone this wiki locally