Your First "Aha" Moment: IIS doesn't run.NET code. It just forwards requests to your app running as a separate process.
1. How IIS + ASP.NET Core Actually Works
Old ASP.NET: IIS loaded your DLL inside w3wp.exe.
ASP.NET Core: IIS uses AspNetCoreModuleV2 as a reverse proxy. Your app runs in dotnet.exe. IIS just passes traffic.
โ 500.30 ANCM In-Process Start Failure
Cause: App crashed before it started.
90% Reason: Wrong.NET runtime, missing web.config, or bad connection string.
โ
Check 3 Things First
1. dotnet --info on server. Runtime installed?
2. Event Viewer โ Windows Logs โ Application
3. stdoutLogEnabled="true" in web.config
2. Publish in 4 Steps - No Fails
Step 1: Install Hosting Bundle
Server โ Download ".NET Core Hosting Bundle" for your version. This installs runtime + AspNetCoreModuleV2. Reboot IIS: iisreset.
Step 2: Publish from VS
Right-click project โ Publish โ Folder โ Target: Framework-dependent, Deployment: win-x64. This creates web.config automatically.
Step 3: IIS Setup
1. Copy publish folder to C:\inetpub\wwwroot\MyApp
2. IIS โ Add Website โ Physical path = your folder.
3. Application Pool โ.NET CLR Version = No Managed Code. Yes, really.
Step 4: Fix Permissions
Folder โ Security โ Give IIS AppPool\MyApp Read+Execute. Give IUSR Read.
If writing files/logs: AppPool needs Write on that folder.
Career-Killer Mistake #1: Setting App Pool to .NET CLR v4.0.
What happens: IIS tries to load your app with CLR. Fails instantly. 500.19 or 500.30.
Fix: ASP.NET Core runs out-of-process. Always No Managed Code.
1. The Interview Theory: InProcess vs OutOfProcess
InProcess: <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> in.csproj. Default. IIS loads your app inside w3wp.exe. Faster. 1 app pool = 1 app. If app crashes, pool dies.
OutOfProcess: IIS starts dotnet MyApp.dll. IIS forwards via named pipe. Slower. More stable. 1 app pool can host many apps.
Staff Rule: Use InProcess unless you need multiple apps per pool or running.NET Core 2.1.
2. The #1 Interview Question: "Debug 500.30"
Your Answer: "500.30 = ANCM failed to start app. Checklist: 1. Check Event Viewer for exact exception. 2. Enable stdout logs: edit web.config, set stdoutLogEnabled=true, stdoutLogFile=.\logs\stdout. Create logs folder. 3. Run dotnet MyApp.dll manually in publish folder. If it crashes there, it's code/config, not IIS. 4. Check dotnet --list-runtimes. App needs exact or compatible runtime. 5. Check connection string. Dev DB won't work from prod server."
3. web.config - The File That Runs Your App
IIS doesn't read appsettings.json. It reads web.config to start your app.
<aspNetCore processPath="dotnet"
arguments=".\MyApp.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="InProcess" />
Key: processPath="dotnet" = framework-dependent. If self-contained publish, path = .\MyApp.exe.
4. Environment & Connection Strings
Theory: Don't put prod secrets in appsettings.json in publish folder. Use environment variables.
IIS Way: IIS โ Configuration Editor โ system.webServer/aspNetCore โ environmentVariables. Add ASPNETCORE_ENVIRONMENT = Production.
Code: builder.Configuration.AddEnvironmentVariables() reads them. Connection string: ConnectionStrings__Default = Server=...;
5. Zero-Downtime Deploy Strategy
| Method | Downtime | How |
| Stop โ Copy โ Start | 30s | Junior way. Users see error. |
| Slot Swap | 0s | Azure/IIS have no slots. Use 2 sites + load balancer. |
| Blue-Green IIS | 0s | Deploy to MyApp_Staging. Warm it up. Switch bindings in IIS. |
Career-Killer Mistake #2: Forgetting <UseAppHost>false</UseAppHost> for FDD.
Theory: Framework-dependent deploy needs dotnet MyApp.dll. If VS generates MyApp.exe, IIS runs exe and ignores runtime. Version mismatch = 500.30.
Fix: Add to.csproj or publish as Framework-dependent + Portable.
No comments yet. Be the first to share your thoughts!