Skip to main content
This guide covers common issues you might encounter when running AspNetRun Microservices and how to resolve them.

Docker Issues

Docker Desktop Not Running

Problem: Error message “Cannot connect to the Docker daemon” Solution:
  1. Start Docker Desktop
  2. Wait for Docker to fully initialize (check system tray icon)
  3. Verify Docker is running:
    docker ps
    

Insufficient Resources

Problem: Services crash or fail to start with out-of-memory errors Solution:
  1. Open Docker Desktop Settings
  2. Go to Resources
  3. Increase Memory to at least 4 GB
  4. Increase CPU to at least 2 cores
  5. Click “Apply & Restart”

Port Conflicts

Problem: “Port is already allocated” error when starting services Solution: Check which ports are in use:
# Windows
netstat -ano | findstr ":<PORT>"

# Linux/Mac
lsof -i :<PORT>
Common port conflicts:
PortServiceAlternative Solution
5432PostgreSQL (Catalog)Stop local PostgreSQL or modify docker-compose.override.yml
5433PostgreSQL (Basket)Change port mapping in docker-compose.override.yml
1433SQL ServerStop local SQL Server
6379RedisStop local Redis instance
5672/15672RabbitMQStop local RabbitMQ
To change a port mapping, edit docker-compose.override.yml:
catalogdb:
  ports:
    - "5434:5432"  # Changed from 5432:5432

Stale Containers or Images

Problem: Services show old code or fail to start after code changes Solution:
  1. Stop and remove all containers:
    docker-compose down
    
  2. Remove old images:
    docker-compose down --rmi all
    
  3. Rebuild and start:
    docker-compose up -d --build
    
  4. For a complete clean start (removes volumes/data):
    docker-compose down -v
    docker system prune -a
    docker-compose up -d --build
    
Using -v flag will delete all database data. Only use this if you want to start fresh.

Database Issues

Connection Timeouts

Problem: “Timeout expired” or “Connection refused” errors Solution:
  1. Verify database containers are running:
    docker-compose ps
    
  2. Check database logs:
    # PostgreSQL Catalog
    docker-compose logs catalogdb
    
    # PostgreSQL Basket
    docker-compose logs basketdb
    
    # SQL Server Order
    docker-compose logs orderdb
    
  3. Wait longer - databases need time to initialize (especially SQL Server)
  4. Restart the specific database container:
    docker-compose restart catalogdb
    

Migration Failures

Problem: Ordering service fails with migration errors Solution:
  1. Check Ordering API logs:
    docker-compose logs ordering.api
    
  2. Verify SQL Server is fully started:
    docker-compose logs orderdb
    
    Look for “SQL Server is now ready for client connections”
  3. Restart the Ordering API:
    docker-compose restart ordering.api
    
  4. If migrations are corrupted, recreate the database:
    docker-compose down
    docker volume rm src_postgres_catalog src_postgres_basket
    docker-compose up -d
    

PostgreSQL Initialization Issues

Problem: Catalog or Basket service cannot connect to PostgreSQL Solution:
  1. Check if database is ready:
    docker exec -it catalogdb pg_isready -U postgres
    
  2. Manually verify connection:
    docker exec -it catalogdb psql -U postgres -d CatalogDb
    
  3. If database is empty, check initialization:
    docker-compose logs catalogdb | grep -i error
    

Service Communication Issues

gRPC Communication Failures

Problem: Basket service cannot connect to Discount gRPC service Symptoms:
  • “gRPC call failed” errors in Basket API logs
  • Products show incorrect prices
Solution:
  1. Verify Discount service is running:
    docker-compose ps discount.grpc
    
  2. Check Discount service logs:
    docker-compose logs discount.grpc
    
  3. Verify the gRPC URL in Basket configuration:
    docker exec -it basket.api env | grep GrpcSettings
    
    Should show: GrpcSettings__DiscountUrl=https://discount.grpc:8081
  4. Check certificate validation (common in development):
    • The Basket service uses DangerousAcceptAnyServerCertificateValidator
    • If this is disabled, you may need to add proper certificates
  5. Restart both services:
    docker-compose restart discount.grpc basket.api
    

RabbitMQ Connection Issues

Problem: Basket checkout doesn’t create orders, or “RabbitMQ connection failed” errors Solution:
  1. Verify RabbitMQ is running:
    docker-compose ps messagebroker
    
  2. Check RabbitMQ logs:
    docker-compose logs messagebroker
    
  3. Access RabbitMQ Management UI:
  4. Verify MassTransit configuration:
    # Check Basket API
    docker-compose logs basket.api | grep -i rabbitmq
    
    # Check Ordering API
    docker-compose logs ordering.api | grep -i rabbitmq
    
  5. Verify connection strings:
    docker exec -it basket.api env | grep MessageBroker
    
    Should show:
    • MessageBroker__Host=amqp://ecommerce-mq:5672
    • MessageBroker__UserName=guest
    • MessageBroker__Password=guest
  6. Restart messaging-related services:
    docker-compose restart messagebroker basket.api ordering.api
    

API Gateway Issues

Problem: Requests through API Gateway fail or return 404 Solution:
  1. Verify all backend services are running:
    docker-compose ps catalog.api basket.api ordering.api
    
  2. Check Gateway logs:
    docker-compose logs yarpapigateway
    
  3. Test backend services directly:
    curl http://localhost:6000/products
    curl http://localhost:6001/basket/testuser
    curl http://localhost:6003/orders
    
  4. Test through Gateway:
    curl http://localhost:6004/catalog-service/products
    curl http://localhost:6004/basket-service/basket/testuser
    curl http://localhost:6004/ordering-service/orders
    
  5. Verify YARP configuration is loaded:
    docker exec -it yarpapigateway cat /app/appsettings.json
    
  6. Check for rate limiting (Ordering service has fixed window limiter):
    • If you get 429 errors, wait a moment and retry
    • Rate limit configuration is in appsettings.json

Application Issues

Web UI Not Loading

Problem: https://localhost:6065 doesn’t load or shows errors Solution:
  1. Check Shopping Web logs:
    docker-compose logs shopping.web
    
  2. Verify API Gateway is accessible:
    curl http://localhost:6004/catalog-service/products
    
  3. Check Web configuration:
    docker exec -it shopping.web env | grep ApiSettings
    
    Should show: ApiSettings__GatewayAddress=http://yarpapigateway:8080
  4. Check browser console for JavaScript errors
  5. Try accessing via HTTP instead: http://localhost:6005

SSL/Certificate Errors

Problem: “SSL connection could not be established” or certificate warnings Solution: For development, the services use self-signed certificates:
  1. Accept the browser certificate warning (click “Advanced” → “Proceed”)
  2. Or use HTTP endpoints instead of HTTPS:

Empty Catalog

Problem: No products display in the Web UI Solution:
  1. Check if Catalog database has seed data:
    docker exec -it catalogdb psql -U postgres -d CatalogDb -c "SELECT * FROM catalog.products;"
    
  2. Verify Catalog API is running in Development mode:
    docker exec -it catalog.api env | grep ASPNETCORE_ENVIRONMENT
    
    Should show: ASPNETCORE_ENVIRONMENT=Development
  3. Check Catalog API logs for initialization:
    docker-compose logs catalog.api | grep -i initial
    
  4. If no seed data, restart Catalog service:
    docker-compose restart catalog.api
    

Performance Issues

Slow Response Times

Problem: API responses are very slow Solution:
  1. Check Docker resource allocation (increase if possible)
  2. Verify Redis is working (Basket uses caching):
    docker exec -it distributedcache redis-cli ping
    
    Should return: PONG
  3. Check for connection pool issues in logs:
    docker-compose logs | grep -i "pool\|timeout"
    
  4. Monitor container resource usage:
    docker stats
    

Memory Leaks

Problem: Containers consume increasing memory over time Solution:
  1. Monitor memory usage:
    docker stats --no-stream
    
  2. Restart problematic container:
    docker-compose restart <service-name>
    
  3. Check for logging issues (excessive logging can consume memory):
    docker-compose logs --tail=100 <service-name>
    

Health Check Issues

Health Endpoints Failing

Problem: /health endpoints return unhealthy status Solution:
  1. Check health endpoint for each service:
    curl http://localhost:6000/health  # Catalog
    curl http://localhost:6001/health  # Basket
    curl http://localhost:6003/health  # Ordering
    
  2. Health checks verify:
    • Catalog: PostgreSQL connection to CatalogDb
    • Basket: PostgreSQL connection to BasketDb + Redis connection
    • Ordering: SQL Server connection to OrderDb
  3. Check specific dependency:
    # For Catalog/Basket - check PostgreSQL
    docker exec -it catalogdb pg_isready
    
    # For Basket - check Redis
    docker exec -it distributedcache redis-cli ping
    
    # For Ordering - check SQL Server
    docker exec -it orderdb /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P SwN12345678 -Q "SELECT 1"
    
  4. Review health check implementation in Program.cs of each service

Debugging Tips

View All Logs

# All services
docker-compose logs -f

# Specific service
docker-compose logs -f catalog.api

# Multiple services
docker-compose logs -f basket.api ordering.api

# Last 100 lines
docker-compose logs --tail=100

# Since specific time
docker-compose logs --since 2024-01-01T00:00:00

Execute Commands in Containers

# Interactive shell
docker exec -it catalog.api /bin/bash

# Run single command
docker exec catalog.api env

Inspect Container Configuration

# View environment variables
docker exec catalog.api env

# View mounted volumes
docker inspect catalog.api | grep -A 10 Mounts

# View network settings
docker inspect catalog.api | grep -A 10 Networks

Check Network Connectivity

# Test connection between containers
docker exec basket.api ping catalogdb
docker exec basket.api curl http://catalog.api:8080/health

Getting Help

If you’re still experiencing issues:
  1. Check the GitHub Issues
  2. Review service logs thoroughly:
    docker-compose logs > all-logs.txt
    
  3. Include the following information when reporting issues:
    • Operating system and version
    • Docker Desktop version
    • Output of docker-compose ps
    • Relevant log excerpts
    • Steps to reproduce the issue

Next Steps

Build docs developers (and LLMs) love