- Added /admin redirect to login page in nginx config - Fixed backend server.js route ordering for proper admin handling - Updated authentication middleware and routes - Added user management routes - Configured PostgreSQL integration - Updated environment configuration
13 KiB
Sky Art Shop - Web Deployment Guide
Target: XAMPP v3.3.0 + No-IP Dynamic DNS
Date: December 3, 2025
🎯 Deployment Overview
This guide will help you deploy your ASP.NET Core application to the web so clients can view it while you continue development locally.
Architecture
Internet → No-IP DNS → Your Public IP → Router Port Forward → XAMPP/IIS → ASP.NET Core App
⚠️ Important Notes
- XAMPP Limitation: XAMPP is primarily for PHP applications. For ASP.NET Core, we'll use IIS (Internet Information Services) or Kestrel as a Windows Service.
- No-IP: Your dynamic DNS will point to your public IP address
- Port Forwarding: You'll need to forward ports 80 (HTTP) and 443 (HTTPS) on your router
- Security: This setup is for preview purposes. For production, use a proper hosting service.
📋 Prerequisites
- ✅ Windows 10/11 with IIS or Windows Server
- ✅ .NET 8.0 Runtime installed
- ✅ MongoDB running on localhost:27017
- ✅ No-IP account configured with your hostname
- ✅ Router access for port forwarding
- ✅ Static local IP for your server machine
🚀 Option 1: Deploy with IIS (Recommended)
Step 1: Enable IIS on Windows
- Open Control Panel → Programs → Turn Windows features on or off
- Check these features:
- ✅ Internet Information Services
- ✅ Web Management Tools
- ✅ World Wide Web Services
- ✅ Application Development Features
- ✅ .NET Extensibility 4.8
- ✅ ASP.NET 4.8
- ✅ Application Development Features
- ✅ IIS Management Console
- Click OK and wait for installation
Step 2: Install ASP.NET Core Hosting Bundle
- Download from: https://dotnet.microsoft.com/download/dotnet/8.0
- Look for "Hosting Bundle" (includes .NET Runtime and IIS support)
- Install and restart your computer
Step 3: Publish Your Application
Run these commands in PowerShell:
cd "E:\Documents\Website Projects\Sky_Art_Shop"
dotnet publish SkyArtShop.csproj -c Release -o "C:\inetpub\wwwroot\skyartshop"
Note: Make sure to run each command separately, pressing Enter after each one.
Step 4: Configure Application Settings for Production
Create production settings:
# Copy appsettings.json to production version
Copy-Item "appsettings.json" "C:\inetpub\wwwroot\skyartshop\appsettings.Production.json"
Step 5: Create IIS Site
- Open IIS Manager (search in Windows Start)
- Expand your server name → Right-click Sites → Add Website
- Configure:
- Site name: SkyArtShop
- Physical path:
C:\inetpub\wwwroot\skyartshop - Binding:
- Type: http
- IP: All Unassigned
- Port: 80
- Host name: (leave empty or add your No-IP hostname)
- Click OK
Step 6: Configure Application Pool
- In IIS Manager, click Application Pools
- Find SkyArtShop pool → Right-click → Basic Settings
- Set .NET CLR version: No Managed Code
- Click OK
- Right-click pool → Advanced Settings
- Set Start Mode: AlwaysRunning
- Set Identity: ApplicationPoolIdentity or your user account
- Click OK
Step 7: Set Permissions
# Grant IIS permissions to your application folder
icacls "C:\inetpub\wwwroot\skyartshop" /grant "IIS_IUSRS:(OI)(CI)F" /T
icacls "C:\inetpub\wwwroot\skyartshop" /grant "IUSR:(OI)(CI)F" /T
# Grant permissions to uploads folder
icacls "C:\inetpub\wwwroot\skyartshop\wwwroot\uploads" /grant "IIS_IUSRS:(OI)(CI)F" /T
🚀 Option 2: Deploy as Windows Service with Kestrel
Step 1: Publish Application
cd "E:\Documents\Website Projects\Sky_Art_Shop"
dotnet publish SkyArtShop.csproj -c Release -o "C:\Services\SkyArtShop"
Step 2: Install as Windows Service
# Install the service using sc.exe command
sc.exe create SkyArtShopService binPath="C:\Services\SkyArtShop\SkyArtShop.exe" start=auto
# Or use NSSM (Non-Sucking Service Manager) - Download from nssm.cc
# Download from: https://nssm.cc/download
nssm install SkyArtShopService "C:\Services\SkyArtShop\SkyArtShop.exe"
Step 3: Configure Service
# Set service to start automatically
sc.exe config SkyArtShopService start=auto
# Start the service
sc.exe start SkyArtShopService
# Check service status
sc.exe query SkyArtShopService
🌐 Network Configuration
Step 1: Set Static Local IP
- Open Control Panel → Network and Sharing Center
- Click your network connection → Properties
- Select Internet Protocol Version 4 (TCP/IPv4) → Properties
- Choose Use the following IP address:
- IP:
192.168.1.100(or similar, check your router's range) - Subnet:
255.255.255.0 - Gateway: Your router IP (usually
192.168.1.1) - DNS:
8.8.8.8(Google DNS)
- IP:
Step 2: Configure Router Port Forwarding
- Access your router admin panel (usually http://192.168.1.1)
- Find Port Forwarding or Virtual Server settings
- Add new rule:
- Service Name: SkyArtShop-HTTP
- External Port: 80
- Internal IP: 192.168.1.100 (your server's static IP)
- Internal Port: 80
- Protocol: TCP
- Add HTTPS rule (optional):
- Service Name: SkyArtShop-HTTPS
- External Port: 443
- Internal IP: 192.168.1.100
- Internal Port: 443
- Protocol: TCP
- Save settings
Step 3: Configure Windows Firewall
# Allow HTTP traffic
New-NetFirewallRule -DisplayName "SkyArtShop-HTTP" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow
# Allow HTTPS traffic (optional)
New-NetFirewallRule -DisplayName "SkyArtShop-HTTPS" -Direction Inbound -Protocol TCP -LocalPort 443 -Action Allow
# Or allow the application itself
New-NetFirewallRule -DisplayName "SkyArtShop-App" -Direction Inbound -Program "C:\inetpub\wwwroot\skyartshop\SkyArtShop.exe" -Action Allow
Step 4: Update No-IP Configuration
- Log in to your No-IP account (https://www.noip.com)
- Go to Dynamic DNS → Hostnames
- Your hostname (e.g.,
yoursite.ddns.net) should already be configured - Install No-IP DUC (Dynamic Update Client) to keep your IP updated:
- Download from: https://www.noip.com/download
- Install and configure with your No-IP credentials
- It will automatically update your DNS when your public IP changes
⚙️ Update Application Configuration
1. Update appsettings.Production.json
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"MongoDB": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "SkyArtShopDB"
},
"AdminUser": {
"Email": "admin@skyartshop.com",
"Password": "Admin123!",
"Name": "Sky Art Shop Admin"
}
}
2. Update Program.cs for Production URLs
The app should listen on all interfaces in production. This is already configured in your Program.cs:
builder.WebHost.UseUrls("http://localhost:5001");
Change to:
// Allow configuration from environment or use default
if (builder.Environment.IsProduction())
{
builder.WebHost.UseUrls("http://*:80", "https://*:443");
}
else
{
builder.WebHost.UseUrls("http://localhost:5001");
}
🔒 Security Considerations
1. Change Admin Password
Update appsettings.Production.json with a strong password:
"AdminUser": {
"Email": "admin@skyartshop.com",
"Password": "YourStrongPassword123!@#",
"Name": "Sky Art Shop Admin"
}
2. Configure HTTPS (Recommended)
For HTTPS, you'll need an SSL certificate:
Option A: Free SSL with Let's Encrypt
- Use Certify The Web (free for IIS): https://certifytheweb.com
- Install and configure with your No-IP domain
- It will automatically obtain and renew certificates
Option B: Self-Signed Certificate (for testing)
# Create self-signed certificate
New-SelfSignedCertificate -DnsName "yoursite.ddns.net" -CertStoreLocation "cert:\LocalMachine\My"
3. Disable Development Features
Ensure ASPNETCORE_ENVIRONMENT is set to Production:
# For IIS (web.config)
# This is automatically set when you publish with -c Release
# For Windows Service
[Environment]::SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Production", "Machine")
📁 File Structure After Deployment
C:\inetpub\wwwroot\skyartshop\ (or C:\Services\SkyArtShop\)
├── SkyArtShop.exe
├── SkyArtShop.dll
├── appsettings.json
├── appsettings.Production.json
├── web.config (auto-generated for IIS)
├── wwwroot\
│ ├── assets\
│ ├── uploads\
│ └── ...
└── ... (other dependencies)
🧪 Testing Your Deployment
Local Testing (on server machine)
- Open browser on server
- Navigate to:
http://localhostorhttp://127.0.0.1 - You should see your site
Network Testing (from another device on same network)
- Find your server's local IP:
192.168.1.100 - On another device (phone/laptop on same WiFi)
- Navigate to:
http://192.168.1.100
Internet Testing (from outside your network)
- Use your No-IP hostname:
http://yoursite.ddns.net - Test from mobile data or ask a friend to visit
- Should load your site from the internet
Troubleshooting Commands
# Check if port 80 is listening
netstat -ano | findstr :80
# Check IIS site status
Get-WebSite -Name "SkyArtShop"
# Check Windows Service status
Get-Service -Name "SkyArtShopService"
# View application logs
Get-EventLog -LogName Application -Source "IIS*" -Newest 20
# Test if MongoDB is accessible
Test-NetConnection -ComputerName localhost -Port 27017
🔄 Updating Your Site (While Keeping it Live)
When you want to update the site:
Method 1: Quick Update (IIS)
# 1. Stop IIS site
Stop-WebSite -Name "SkyArtShop"
# 2. Publish new version
cd "E:\Documents\Website Projects\Sky_Art_Shop"
dotnet publish SkyArtShop.csproj -c Release -o "C:\inetpub\wwwroot\skyartshop"
# 3. Start IIS site
Start-WebSite -Name "SkyArtShop"
Method 2: Zero-Downtime Update
# 1. Publish to new folder
dotnet publish SkyArtShop.csproj -c Release -o "C:\inetpub\wwwroot\skyartshop_new"
# 2. Stop site
Stop-WebSite -Name "SkyArtShop"
# 3. Backup old version
Rename-Item "C:\inetpub\wwwroot\skyartshop" "skyartshop_backup"
# 4. Switch to new version
Rename-Item "C:\inetpub\wwwroot\skyartshop_new" "skyartshop"
# 5. Start site
Start-WebSite -Name "SkyArtShop"
# 6. Test and remove backup if successful
# Remove-Item "C:\inetpub\wwwroot\skyartshop_backup" -Recurse
📊 Monitoring
Check Application Status
# IIS
Get-WebSite -Name "SkyArtShop" | Select-Object Name, State, PhysicalPath
# Windows Service
Get-Service -Name "SkyArtShopService" | Select-Object Name, Status, StartType
View Logs
Logs location:
- IIS:
C:\inetpub\wwwroot\skyartshop\logs\(if configured) - Windows Event Viewer: Application logs
- MongoDB: Check MongoDB logs for database issues
🎯 Quick Deployment Checklist
- .NET 8.0 Hosting Bundle installed
- IIS enabled and configured
- Application published to IIS folder
- Application pool configured (No Managed Code)
- Folder permissions set (IIS_IUSRS)
- Static local IP configured
- Router port forwarding setup (port 80)
- Windows Firewall rules added
- No-IP DUC client installed and running
- MongoDB running on localhost
- Production settings configured
- Admin password changed
- Site tested locally
- Site tested from local network
- Site tested from internet (No-IP hostname)
🆘 Common Issues & Solutions
Issue 1: HTTP Error 502.5
Cause: ASP.NET Core Runtime not installed
Solution: Install .NET 8.0 Hosting Bundle
Issue 2: Site Not Accessible from Internet
Cause: Port forwarding not configured
Solution: Check router settings, ensure port 80 is forwarded to correct local IP
Issue 3: 403 Forbidden Error
Cause: Permissions issue
Solution: Run the icacls commands to grant IIS permissions
Issue 4: MongoDB Connection Failed
Cause: MongoDB not running
Solution: Start MongoDB service: net start MongoDB
Issue 5: No-IP Hostname Not Resolving
Cause: No-IP DUC not running or IP not updated
Solution: Install/restart No-IP DUC client
📞 Support Resources
- IIS Documentation: https://docs.microsoft.com/en-us/iis
- ASP.NET Core Hosting: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/
- No-IP Support: https://www.noip.com/support
- Let's Encrypt: https://letsencrypt.org
🎉 Success
Once deployed, your site will be accessible at:
- Local: http://localhost
- Network: http://192.168.1.100 (your local IP)
- Internet: http://yoursite.ddns.net (your No-IP hostname)
Clients can view the site while you continue development locally on port 5001! 🚀