NTFS Permissions for IIS App Pools: Inheritance, Identity, and the 500.19 Trap

The share-permission article on this site covers SMB file servers. This one is about the narrower and far more common failure: an IIS application that throws HTTP 500.19 on a configuration file, or a 401.3 on a static asset, because the app pool identity never had the ACL in the first place — or had it and lost it when someone copied the folder.

What the app pool identity actually is

In IIS 7 and later, an app pool runs as ApplicationPoolIdentity by default, which resolves to a virtual account named IIS AppPool\. That account is a real security principal: it is a member of IIS_IUSRS automatically, and it can hold NTFS permissions directly even though it has no local user profile on disk. The display name in icacls output is IIS APPPOOL\MySite, and permissions on a Windows VPS are fully under your control.

Confirm what a site is really running as before touching any ACL. appcmd list apppool /name:MySite /text:processModel.identityType returns the configured identity, and Get-Process w3wp | Select Id, StartTime paired with the worker process mapping in appcmd list wp shows which pool owns which PID. A pool set to NetworkService or a custom user needs completely different ACLs than the default virtual account.

Read the 500.19 before you guess at permissions

HTTP 500.19 with error code 0x80070005 means access denied, and the message text names the configuration file it could not read — usually web.config. That is an ACL problem on the file, not a web.config syntax problem. The same status code with 0x8007000d is malformed XML, and 0x800700b7 is a duplicate section definition; those need a config fix, not a permission change.

Look at the detail line rather than the code. IIS reports Config File, Config Source and the requesting identity. If the identity shown is the pool account and the file is one you can open in Notepad as administrator, the ACL is missing that specific principal. Enable failed request tracing if the message is truncated: %SystemDrive%\inetpub\logs\FailedReqLogFiles holds the full trace once the rule is on for the site.

Inheritance is usually the real culprit

Copying a published folder with robocopy without /COPYALL preserves files but drops ACLs. Extracting a zip created on another machine brings whatever DACL the archive tool stamped onto the parent. Moving a folder between volumes on Windows preserves permissions only for same-volume moves; a cross-volume move becomes a copy and inherits the destination. Any of these leaves a site that worked on the build server failing on the target.

Check inheritance on the site root with icacls C:\inetpub\MySite. Output lines ending in (I) are inherited; lines without it are explicit and survive parent changes. If the root has an explicit deny or a broken inheritance flag, the fix is at the root, not on the individual file. Explicit ACEs on subfolders that were copied along are the usual reason a permission fix on the root does not take effect.

Build the ACL deliberately, not by hand

Grant the pool identity read and execute on the application directory, and write only where the app writes. icacls C:\inetpub\MySite /grant "IIS APPPOOL\MySite:(OI)(CI)RX" /T applies inherited read to the tree. Then grant modify on a single directory: icacls C:\inetpub\MySite\App_Data /grant "IIS APPPOOL\MySite:(OI)(CI)M". Do not grant Full Control on the site root — a compromise in the app then rewrites its own compiled assemblies.

The uploads and cache directories deserve the modify grant; bin, web.config and the compiled views do not. (OI)(CI) makes the entry inherit to files and folders created later, which is what makes the grant survive the next deployment. Skip that flag and the next build drops new files the pool cannot read.

Fix the inheritance flag itself

When a folder shows Access is denied for administrators or the copied ACEs are stubborn, reset inheritance explicitly. icacls C:\inetpub\MySite /inheritance:e re-enables inheritance from the parent, and /reset /T replaces the whole tree’s ACLs with what the parent supplies. Run /inheritance:r only when you intend to remove inherited entries and keep explicit ones — that is a destructive operation on a web root and should be preceded by icacls C:\inetpub\MySite /save acl_backup.txt /T.

On a correctly built host the C:\inetpub root grants IIS_IUSRS read and execute with inheritance on, and every site gets its extra grants beneath it. If someone has set deny ACEs anywhere in that chain, the pool account inherits the deny and no amount of granting below it will help — deny always beats allow in the Windows access check.

Verify effective access instead of assuming

After changing an ACL, prove it with the tool that evaluates the real access check. icacls C:\inetpub\MySite\web.config prints granted and denied entries for that file, and PowerShell’s Get-Acl gives the object model. For the definitive test, use the Effective Access tab in the file’s Advanced Security dialog against IIS APPPOOL\MySite, or reuse the pool account in a schtasks run if you need a scriptable check.

Recycle the pool after ACL changes: appcmd recycle apppool /apppool.name:MySite. The worker process caches access tokens and file handles, so a running pool can keep failing on a file that is now readable. Confirm the fresh request succeeds before declaring the fix complete, and check the IIS log for the new status code rather than relying on a browser refresh.

Make it survive the next deployment

Every deployment pipeline needs a step that reapplies ACLs, not just one that copies files. A one-line icacls call in the post-publish script is enough, and it removes the entire class of “worked on staging, 500.19 in production” incidents. Include the pool name as a variable so the script works for any site on the box.

If you are still deciding where to run this, pick a host that gives you full administrative control over the file system and the IIS metabase — the article on Windows VPS hosting covers what that means in practice. And before the next deployment, write the current ACL state to a file so you have something to compare against when the app suddenly cannot read its own config.

Leave a Comment