Zero-to-first-run backend setup on Windows. Target: ≤15 minutes from clone to running API.
-
# Verify installation dotnet --version # Should show: 8.0.x
-
Git (if not already installed)
# Verify installation git --version
- Visual Studio 2022 (Community/Professional) with ASP.NET workload
- VS Code with C# Dev Kit extension
- Windows Terminal or PowerShell
# Clone repository
git clone https://github.com/MachDatum/ThingConnect.Pulse.git
cd ThingConnect.Pulse
# Restore packages
dotnet restore# Create application data directory
mkdir "C:\ProgramData\ThingConnect.Pulse"
# Create minimal config file (optional for first run)
echo "# Minimal config for first run" > "C:\ProgramData\ThingConnect.Pulse\config.yaml"# Navigate to backend project
cd ThingConnect.Pulse.Server
# Run in development mode
dotnet run
# Expected output:
# info: Microsoft.Hosting.Lifetime[14]
# Now listening on: http://localhost:8080
# info: Microsoft.Hosting.Lifetime[0]
# Application started. Press Ctrl+C to shut down.Open browser to:
- API: http://localhost:8080/swagger - Swagger UI
- Health Check: http://localhost:8080/health (if implemented)
- Static Files: http://localhost:8080 - Frontend proxy
The backend uses these configuration files:
- Base configuration shared across environments
- Connection string to SQLite database
- Default application settings
- Development-specific overrides
- Enhanced logging (including EF Core SQL)
- HTTP-only Kestrel endpoint on port 8080
- Development database path
ThingConnect Pulse uses SQLite for simplicity:
# Database location
C:\ProgramData\ThingConnect.Pulse\pulse.db
# Auto-created on first run (when EF Core is implemented)
# No manual database setup requiredSample minimal config.yaml:
# C:\ProgramData\ThingConnect.Pulse\config.yaml
targets:
- host: "8.8.8.8"
name: "Google DNS"
- host: "1.1.1.1"
name: "Cloudflare DNS"
defaults:
probe_type: "icmp"
interval_seconds: 60# Build solution
dotnet build
# Build specific project
dotnet build ThingConnect.Pulse.Server
# Build for Release
dotnet build -c Release# Run with hot reload
dotnet watch run
# Run specific configuration
dotnet run --configuration Release
# Run with custom port
dotnet run --urls="http://localhost:9000"# Run all tests (when implemented)
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"# When EF Core is implemented:
# Add migration
dotnet ef migrations add InitialCreate
# Update database
dotnet ef database update
# Reset database
dotnet ef database drop --force
dotnet ef database updateInstead of editing appsettings.json, you can use environment variables:
# PowerShell
$env:ConnectionStrings__DefaultConnection = "Data Source=C:\ProgramData\ThingConnect.Pulse\pulse.db"
$env:Pulse__ConfigPath = "C:\ProgramData\ThingConnect.Pulse\config.yaml"
$env:ASPNETCORE_URLS = "http://localhost:8080"
# Command Prompt
set ConnectionStrings__DefaultConnection=Data Source=C:\ProgramData\ThingConnect.Pulse\pulse.db
set Pulse__ConfigPath=C:\ProgramData\ThingConnect.Pulse\config.yaml
set ASPNETCORE_URLS=http://localhost:8080Error: Unable to start Kestrel. Address already in use: http://localhost:8080
Solution:
# Find process using port
netstat -ano | findstr :8080
# Kill process (replace PID)
taskkill /PID <process-id> /F
# Or use different port
dotnet run --urls="http://localhost:9000"Error: SQLite Error 14: 'unable to open database file'
Solutions:
- Ensure
C:\ProgramData\ThingConnect.Pulse\directory exists - Check folder permissions (should be writable by current user)
- Verify database path in connection string
Warning: Configuration file not found: C:\ProgramData\ThingConnect.Pulse\config.yaml
Solution:
# Create directory
mkdir "C:\ProgramData\ThingConnect.Pulse"
# Create minimal config
echo "targets: []" > "C:\ProgramData\ThingConnect.Pulse\config.yaml"When developing network monitoring features:
# Check if ICMP is blocked
ping 8.8.8.8
# If blocked, enable ICMP in Windows Firewall:
# 1. Windows Security > Firewall & network protection
# 2. Advanced settings > Inbound Rules
# 3. Enable "File and Printer Sharing (Echo Request - ICMPv4-In)"Some network operations may require elevated privileges:
# Run as administrator (if needed for raw sockets/ICMP)
# Right-click terminal > "Run as administrator"
dotnet run# List network interfaces (PowerShell)
Get-NetAdapter
# Check IP configuration
ipconfig /all# Disable analysis in Debug builds (faster compilation)
dotnet build -p:RunAnalyzersDuringBuild=false
# Skip frontend build during backend development
dotnet build --no-dependencies ThingConnect.Pulse.Server# Enable garbage collection logs
$env:COMPlus_gcServer = 1
dotnet runEdit appsettings.Development.json:
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft.AspNetCore": "Information",
"Microsoft.EntityFrameworkCore.Database.Command": "Information"
}
}
}# Install Serilog (optional, for better logging)
dotnet add package Serilog.AspNetCore
dotnet add package Serilog.Sinks.Console- Open
ThingConnect.Pulse.sln - Set
ThingConnect.Pulse.Serveras startup project - Press F5 to run with debugging
- Open project folder
- Install C# Dev Kit extension
- Use
Ctrl+F5to run without debugging - Use
F5to run with debugging
- IntelliSense should work automatically with .editorconfig
- Code formatting available with
dotnet format - Build errors shown in Problems panel
After successful backend setup:
- Verify API: Check Swagger UI at http://localhost:8080/swagger
- Check Logs: Monitor console output for any warnings
- Frontend Setup: Follow
/ops/dev.mdfor full-stack development - Database: Implement EF Core models (Issue #10)
- Cold start: < 5 seconds
- Hot reload: < 2 seconds
- Build time: < 30 seconds (backend only)
- Memory usage: < 50MB (minimal load)
- Development only: HTTP on localhost:8080
- No authentication: v1 has no auth (localhost + LAN only)
- Database: SQLite file-based, no network exposure
- Firewall: May need ICMP/ping permissions for monitoring
Need Help?
- Check the main
/ops/dev.mdfor general commands - Review GitHub issues for current development status
- Check application logs in console output