Skip to content
INSIGHTS & GUIDES · NETCLOUD24

Building an IIS site with its own worker-process boundary

Build a dedicated IIS site and pool with deliberate runtime and anonymous identity, read-only code access and a unique staging response, then promote or remove it without confusing configuration with application data.

Read the article ↓
Editorial illustration: How to Create an IIS Website and Application Pool with PowerShell

Platform: Windows Server 2019, 2022 and 2025, with the version and hosting restrictions described below.

Define the application boundary before the website name

A website binding, application pool and content folder serve different purposes in IIS. The binding selects requests, the pool provides a worker-process context, and the folder contains the deployed application. A dedicated pool makes identity, recycling and failure investigation easier to separate from neighbouring sites. It does not automatically secure the folder or install the correct runtime.

Netcloud24 prepares those hosting components for the agreed managed application. This workflow describes the authorised administrator’s build and acceptance checks. Customers using a prepared site should receive its access and support details rather than being expected to create application pools. The example uses a harmless static readiness page before the real application is introduced.

Reserve names, paths and a staging binding

Choose a new site called ServiceDesk and a pool called ServiceDesk-Worker. For the example, an internal staging hostname uses port 8090 and content lives on E:. Replace these choices with the service inventory. A host header is a routing selector, not proof that only authorised users can reach the content.

Check existing sites, pools, listeners and paths. An existing VHD-style or data-volume convention on another server does not establish what E: means here. Preserve IIS configuration before changing a shared server and ensure staging exposure is restricted by the actual network policy.

Import-Module WebAdministration
Get-Website | Select-Object Name,State,PhysicalPath,Bindings
Get-ChildItem IIS:\AppPools | Select-Object Name,State
Get-WebBinding
Get-NetTCPConnection -State Listen -LocalPort 8090 -ErrorAction SilentlyContinue
Test-Path 'E:\Web\ServiceDesk'

A conflict should lead to inspecting the owner. Do not stop another application or overwrite its directory to make a creation command succeed. Separate the new pilot from existing production names and data.

Create a pool whose runtime matches the workload

For static content, use No Managed Code and ApplicationPoolIdentity. The latter supplies a distinct virtual identity without a manually managed account password. A classic ASP.NET Framework workload may need v4.0, while ASP.NET Core uses its supported hosting module and runtime. The setting below is specific to this static readiness stage.

New-WebAppPool -Name 'ServiceDesk-Worker'
Set-ItemProperty 'IIS:\AppPools\ServiceDesk-Worker' `
  -Name managedRuntimeVersion -Value ''
Set-ItemProperty 'IIS:\AppPools\ServiceDesk-Worker' `
  -Name processModel.identityType -Value ApplicationPoolIdentity
Get-WebAppPoolState -Name 'ServiceDesk-Worker'

Keep default process behaviour until the application supplies a justified requirement. Web gardens, disabled recycling and 32-bit mode are not generic performance improvements. Record later changes with their application reason, especially when a vendor’s runtime or in-memory session state constrains the design.

Give runtime read access without giving it deployment authority

Create a new directory and readiness page. The directory command deliberately fails if the site path already exists, avoiding an accidental reuse of unknown content. Review inherited permissions and preserve SYSTEM and authorised administration access before exposing it.

$contentRoot = 'E:\Web\ServiceDesk'
New-Item -ItemType Directory -Path $contentRoot -ErrorAction Stop | Out-Null
Set-Content ($contentRoot + '\index.html') -Encoding UTF8 `
  -Value '<!doctype html><title>ServiceDesk build</title><p>ServiceDesk readiness endpoint.</p>'
icacls $contentRoot /grant:r 'IIS AppPool\ServiceDesk-Worker:(OI)(CI)RX'
icacls $contentRoot

Read and execute allows the runtime to serve its code and static files. It does not permit the application to replace them. If uploads or generated files are needed later, grant only the reviewed data folder, preferably outside executable content where supported. Keep deployment write access separate from runtime access and avoid broad IIS_IUSRS write grants across all sites.

Publish one explicit binding and choose the anonymous identity

Create the site with its dedicated pool, path and staging host header. For this public-to-the-test-network static page, anonymous requests are deliberate. Configure them to use the pool identity so the file ACL and the request’s file-access identity align.

New-Website -Name 'ServiceDesk' -ApplicationPool 'ServiceDesk-Worker' `
  -PhysicalPath $contentRoot -IPAddress '*' -Port 8090 `
  -HostHeader 'servicedesk-stage.corp.example'
Set-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' `
  -Location 'ServiceDesk' `
  -Filter 'system.webServer/security/authentication/anonymousAuthentication' `
  -Name userName -Value ''
Get-WebBinding -Name 'ServiceDesk'

The default anonymous identity can otherwise be IUSR, making a pool-only ACL appear ineffective. Authentication requirements for the real application are a separate reviewed step. If the configuration section is locked, make the authorised server-level change rather than trying to bypass policy in web.config. Use a specific local IP instead of a wildcard where that is the intended listening boundary.

Verify content selection, not merely a successful status

Send a local request with the intended Host header, then repeat from an approved staging client using DNS. Inspect the response body so a 200 from the wrong site is not mistaken for acceptance. Confirm the request appears in the correct site-ID log, allowing for buffering.

$check = Invoke-WebRequest 'http://127.0.0.1:8090/' `
  -Headers @{Host='servicedesk-stage.corp.example'} -UseBasicParsing
$check.StatusCode
$check.Content
Get-Website -Name 'ServiceDesk' | Select-Object Name,Id,State,PhysicalPath

Verify the approved network can reach the listener and an excluded network cannot if firewall scope supplies that boundary. Do not publish diagnostic environment dumps, credentials or stack traces as readiness content. Once the real application is deployed, add its functional checks; serving index.html demonstrates only the base hosting path.

Investigate errors at the correct layer

A binding conflict calls for reviewing all site bindings and listener ownership. A 403.14 can mean no default document, not a need to enable directory browsing. A 401 or file-access error requires checking the actual anonymous and process identity and the requested object’s ACL. A child file with disabled inheritance can differ from its parent.

For 503, inspect pool state, rapid-fail protection and WAS/application events. Repeated restarts can hide the first failure. A 500.19 provides configuration file and error detail that distinguishes missing modules, locked sections and malformed content. If the readiness page works but the application fails, inspect runtime and handler prerequisites before expanding file permissions.

Promote or remove the build with separate decisions for data

Production preparation includes the real application, approved HTTPS name and certificate, authentication, logging, monitoring and backups. Document the site-to-pool mapping and permitted runtime writes. The managed handover should explain the available service, access and escalation path; the operational team retains the implementation and recovery record.

If the pilot is cancelled, stop and remove only its site and unused pool after checking references. Removing IIS objects does not determine whether the content is disposable. Preserve any uploaded or application data before deleting directories. Conversely, keeping an unused staging listener indefinitely is not a rollback strategy: close its exposure once the build decision is complete.

Further reading


Was this answer helpful?

« Back
Contact

Write to us

Do you have questions about our services or need a quote? Write to us and we will respond as soon as possible.

Contact form

Fields marked * are required.