1. Introduction
For any production web application, downtime is costly — users lose access, transactions fail, and trust drops.
When you deploy a new version of your ASP.NET Core app, your goal should be clear: users should never experience downtime.
This approach is called Zero Downtime Deployment (ZDD) — meaning your application stays live and responsive even while new code is being deployed or old instances are being replaced.
In this article, we’ll explore step-by-step strategies to achieve Zero Downtime Deployment for ASP.NET Core applications hosted on IIS (Windows Server), using CI/CD pipelines with Jenkins or GitHub Actions.
We’ll also look at practical configuration tips, code samples, and a technical workflow diagram.
2. Why Zero Downtime Matters
Imagine you deploy a critical ASP.NET Core app for your client. The deployment takes 2 minutes. During that time:
The IIS app pool restarts.
Active user sessions are lost.
New requests return a 503 – Service Unavailable error.
This might sound minor, but if 1000+ users are active, even a few seconds of downtime can impact business operations.
Zero Downtime Deployment ensures
No 503 or restart interruptions.
Sessions and active requests remain stable.
Rollbacks are fast if something breaks.
Continuous delivery becomes truly continuous.
3. Core Idea Behind Zero Downtime
Zero Downtime Deployment is built on three main pillars:
Multiple instances or slots of the same app (old + new).
Load balancing or traffic redirection between instances.
Atomic switch-over once the new version is verified.
In IIS-based environments, this can be achieved through:
Blue-Green deployment strategy
Rolling updates using multiple servers
Deployment slot swapping (if using Azure App Services)
Load balancer (ARR, Nginx, or hardware-based)
4. Technical Workflow Flowchart
Here’s the technical workflow that shows how a typical Zero Downtime Deployment pipeline works in IIS with Jenkins or GitHub Actions:
┌────────────────────────────┐
│ Developer commits code │
└────────────┬───────────────┘
│
▼
┌──────────────────────┐
│ CI/CD Pipeline (Jenkins│
│ or GitHub Actions) │
└────────────┬──────────┘
│
┌───────────▼────────────┐
│ Build & Test Project │
│ dotnet publish │
└───────────┬────────────┘
│
┌──────────────────▼────────────────────┐
│ Deploy to Staging (Green Environment)│
│ IIS site: myapp-green │
└──────────────────┬────────────────────┘
│
▼
┌───────────────────────┐
│ Smoke Test / Health │
│ Check Green Site │
└───────────┬───────────┘
│
┌─────────────────▼────────────────┐
│ If Healthy → Switch Load Balancer│
│ from Blue → Green │
└─────────────────┬────────────────┘
│
▼
┌──────────────────┐
│ Monitor Traffic │
│ Rollback if Fail│
└──────────────────┘
5. Step-by-Step Implementation
Let’s break down the process for ASP.NET Core + IIS + Jenkins setup.
Step 1: Prepare IIS with Blue-Green Sites
You need two IIS sites:
myapp-blue → current production version
myapp-green → staging or upcoming version
Each point to a different physical folder, e.g.
C:\inetpub\wwwroot\myapp-blueC:\inetpub\wwwroot\myapp-greenBoth should
Run on the same application pool.
Have the same bindings (except port if on the same server).
Share the same database and configuration (except for version differences).
Step 2: Build and Publish the ASP.NET Core App
In Jenkins, your build stage should execute the following:
dotnet clean
dotnet restore
dotnet build --configuration Release
dotnet publish -c Release -o ./publish
This generates the compiled files ready to deploy.
Step 3: Deploy to Green Environment
Copy the published output to the myapp-green folder.
Example PowerShell command (used in Jenkins pipeline):
Copy-Item -Path "C:\Jenkins\workspace\MyApp\publish\*" `
-Destination "C:\inetpub\wwwroot\myapp-green" `
-Recurse -Force
Then restart only the myapp-green site:
Restart-WebAppPool "MyAppPool"
Start-WebSite "myapp-green"
Step 4: Health Check and Validation
Run a simple smoke test to confirm that the Green site is working fine:
curl http://localhost:8081/health
Your ASP.NET Core app should have a health endpoint like this:
// In Program.cs
app.MapGet("/health", () => Results.Ok("Healthy"));
If the result is “Healthy,” you can safely switch traffic.
Step 5: Switch Traffic from Blue → Green
You can switch manually or automatically.
Option 1: DNS Switch (Simple but Slower)
Update your DNS or reverse proxy to point from myapp-blue to myapp-green.

Join the conversation! Your thoughts help the community grow.