Sorcha Troubleshooting Guide
Common Issues and Solutions
1. Port Already in Use Errors
Symptoms:
error: could not start the proxy for the service: listen tcp [::1]:8080: bind:
Only one usage of each socket address is normally permitted.Cause:
- Previous dotnet processes didn't shut down cleanly
- Ports are still bound from previous run
Solutions:
Quick Fix - Use Cleanup Script (Easiest)
# Windows PowerShell
.\scripts\cleanup-ports.ps1
# Or Git Bash/Unix/Mac
bash scripts/cleanup-ports.shManual Fix - Kill Specific Process
# Windows - Find process on port
netstat -ano | findstr ":8080"
# Kill the process (replace PID with actual number)
taskkill /F /PID 12345# Unix/Mac - Find and kill process
lsof -ti:8080 | xargs kill -9Nuclear Option - Kill All .NET Processes
# Windows
taskkill /F /IM dotnet.exe
# Unix/Mac
killall -9 dotnet2. Aspire DCP Timeout Errors
Symptoms:
fail: Aspire.Hosting.Dcp.dcpctrl.dcpctrl.ServiceReconciler[0]
Service status update failed
error": "Timeout: request did not complete within requested timeout"Causes:
- Services taking longer than expected to start
- Docker Desktop resource constraints
- First-time container image downloads
Solutions:
A. Increase Docker Resources (Recommended)
- Open Docker Desktop
- Go to Settings → Resources
- Increase:
- CPUs: At least 4 cores
- Memory: At least 8 GB
- Swap: At least 2 GB
- Click "Apply & Restart"
B. Wait Longer
- These are warnings, not errors
- Services often start successfully despite timeouts
- Wait 2-3 minutes and check the Aspire dashboard
- Dashboard URL is shown in console:
https://localhost:17256
C. Start Services Individually
# Start just the backend services first
cd src/Apps/Orchestration/Sorcha.AppHost
dotnet run
# Wait for all services to show "Running" in dashboard
# Then access:
# - Gateway: Check dashboard for port
# - Blazor: Check dashboard for portD. Clean Docker State
# Stop all containers
docker stop $(docker ps -aq)
# Remove Aspire containers
docker rm $(docker ps -aq -f name=redis)
docker rm $(docker ps -aq -f name=rediscommander)
# Restart AppHost
cd src/Apps/Orchestration/Sorcha.AppHost
dotnet run2. Port Conflicts
Symptoms:
Error: Failed to bind to address https://localhost:7082Solutions:
Check Ports in Use
# Windows
netstat -ano | findstr "8050 8060 8070 8080"
# Kill process (replace PID)
taskkill /F /PID <PID>Use Different Ports
Edit launchSettings.json for each service or let Aspire assign dynamic ports.
3. Build Errors with File Locks
Symptoms:
error MSB3027: Could not copy "Sorcha.ServiceDefaults.dll"
The file is locked by: "Sorcha.Blueprint.Api (12345)"Solutions:
Stop All Running Services
# Windows - Stop all dotnet processes
taskkill /F /IM dotnet.exe
# Or use Task Manager to end dotnet.exe processesClean and Rebuild
dotnet clean
dotnet build4. Redis Connection Errors
Symptoms:
StackExchange.Redis.RedisConnectionException: No connection is availableSolutions:
Verify Docker is Running
docker ps | grep redisRestart Redis via AppHost
The AppHost will automatically start Redis. Just restart the AppHost.
Manual Redis Start (if needed)
docker run -d -p 6379:6379 redis:8.25. Blazor Client Not Connecting to Gateway
Symptoms:
- Blazor app loads but API calls fail
- CORS errors in browser console
- 404 errors when calling
/api/*endpoints
Solutions:
Check ApiConfiguration
File: src/Apps/UI/Sorcha.Blueprint.Designer.Client/Services/ApiConfiguration.cs
public static string GatewayBaseUrl { get; set; } = "https://localhost:8061";Update the port to match what Aspire assigned to the gateway.
Check Aspire Dashboard
- Open dashboard:
https://localhost:17256 - Find
api-gatewayservice - Note the HTTPS endpoint (e.g.,
https://localhost:8061) - Update
GatewayBaseUrlto match
6. Integration Tests Failing
Symptoms:
Test run failed: DistributedApplication could not startSolutions:
Stop Running Services First
Integration tests start their own services:
# Stop AppHost if running
# Then run tests:
dotnet test tests/Sorcha.Gateway.Integration.TestsCheck Docker Resources
Tests need Docker for Redis:
- Ensure Docker Desktop is running
- Ensure at least 4GB RAM allocated
Increase Test Timeout
Edit test if needed:
[Fact(Timeout = 300000)] // 5 minutes
public async Task MyTest() { ... }7. OpenAPI/Swagger Not Loading
Symptoms:
/scalar/v1returns 404/openapi/v1.jsonreturns 404
Solutions:
Check Environment
OpenAPI is only enabled in Development:
# Set environment variable
$env:ASPNETCORE_ENVIRONMENT="Development"
# Or in launchSettings.json:
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}Verify Gateway is Running
curl https://localhost:8061/api/health8. Peer Service Not Discovering Peers
Symptoms:
/api/peer/peersreturns empty list- Peer dashboard shows no connections
Solutions:
This is expected in development - peer discovery requires:
- Multiple peer service instances running
- Network configuration for peer-to-peer communication
- Production deployment for actual peer network
For development, the service will run but show no peers.
Diagnostic Commands
Check All Services Status
# Via Aspire Dashboard
# Open: https://localhost:17256
# Via curl
curl http://localhost:8061/api/health
curl http://localhost:8061/api/statsCheck Logs
# Logs are in Aspire dashboard
# Or check individual service logs in bin/Debug/net10.0/Verify Docker
docker ps
docker statsVerify .NET
dotnet --info
dotnet --list-sdksPerformance Tuning
Reduce Startup Time
Disable Unused Services Comment out services in AppHost.cs if not needed
Use Release Build
bashdotnet run -c Release --project src/Apps/Orchestration/Sorcha.AppHostIncrease Docker Resources More RAM/CPU = faster startup
Reduce Memory Usage
Stop Services When Not Needed Don't leave AppHost running when not developing
Use Minimal Configuration Only run services you're actively working on
Getting Help
If issues persist:
- Check Logs: Look in Aspire dashboard for detailed error messages
- GitHub Issues: https://github.com/yourusername/sorcha/issues
- Aspire Docs: https://learn.microsoft.com/dotnet/aspire/
- Clean Slate: Delete
bin/,obj/, restart Docker, rebuild
Known Limitations
- First Run Slow: Initial Docker image download takes time
- Windows Defender: May slow file access - add exclusions for project folder
- VPN Issues: Some VPNs interfere with Docker networking
- WSL2 Performance: File I/O in WSL2 can be slower than native Windows