That error message means IIS found a problem in a configuration file before the requested page ever executed, so the fault almost always sits in the site's web.config, a parent directory's web.config, or applicationHost.config. The page itself is rarely broken; the settings engine refused to build a valid configuration tree. Confirm the affected URL, then read the error page past the generic headline — IIS prints the config file path, line number, and error code, which tell you which of three distinct faults you have. This guide covers all three, in the order you should investigate them.

What Error 500.19 Actually Reports Before the Page Runs

IIS compiles configuration from the machine level down to the site folder before it hands a request to ASP.NET, and 500.19 (HRESULT 0x8007000D) fires when that compilation fails. The status code is HTTP-level and lives in the Windows HTTP Server API, which is why the error can appear for static HTML files, images, and API routes alike — none of that content is ever reached. In practical terms, the 500.19 family means "your server's settings tree is inconsistent or unauthorized," and the page-level output is a symptom.

The most useful habit here is reading the error page top to bottom instead of reloading it. IIS displays "Config Error," showing the exact element that failed, "Config File," showing the physical path such as \?\C:\inetpub\wwwroot\app\web.config, and "Config Source," showing the surrounding XML with the offending line marked. That one screen usually eliminates two of the three failure families in a few seconds. Guessing without it is the slowest possible approach.

The three families are distinct and each has its own fix. First is malformed XML — an unclosed tag, a duplicated section, a stray character from a copy-paste, or a certificate-export artifact baked into the file. Second is permission-based: the file exists and parses but the worker process identity cannot read it. Third is a configuration-lock problem, where the section is legal in general but the site's web.config is not allowed to set it because a higher level has locked it. The error code on the page (0x8007000D, 0x80070005, and error code 0x80070021, respectively) maps almost one-to-one onto those families, which is why professional IIS troubleshooters quote the code before anything else.

One quirk catches developers who move code from a workstation to a server: Visual Studio's "Encrypt configuration sections" feature, resolved through the aspnet_regiis.exe tool, can produce a web.config whose encrypted sections are undecryptable on the target machine. The file looks structurally valid and the XML parser accepts it, yet IIS fails when it tries to interpret the encrypted element. Treat any web.config copied from another environment as suspect until you have compared it against the server's own baseline copy.

Decode the Config Error Code Before You Edit Anything

The three codes you will meet most often on the error page carry different meanings, and the fix for one will not touch the others. This table is the fastest way to orient yourself without touching the server.

Error code Typical message fragment Underlying cause First corrective action
0x8007000D "The requested page cannot be accessed because the related configuration data for the page is invalid" Malformed XML: unclosed tag, duplicate section, stray character Validate the file in an XML editor, fix the marked line, save with UTF-8 without BOM
0x80070005 "Access is denied" Worker process identity lacks read access to web.config or its folder Grant IIS_IUSRS read on the site folder, check NTFS inheritance
0x80070021 "This configuration section cannot be used at this path" Section locked at a higher level in applicationHost.config Locate the overrideModeDefault lock and change it at server level
0x800700B7 "Cannot add duplicate collection entry" Second definition of the same section or element Remove the duplicate from web.config, keep one authoritative copy

Read the code from the error page rather than from memory, because a page that fails at a child element can surface a third code that briefly masks the real cause. If the page shows 0x8007000D but your editor finds nothing, the malformed byte may be invisible in normal whitespace view — open the file in a hex viewer or an XML-aware editor that can reveal a carriage-return/line-feed mismatch, which single-byte tools routinely miss.

Version matters as well. IIS 7.0 through 10.0 all use the same 500.19 family, and IIS 7.5 on Windows Server 2008 R2 introduced stricter defaults for some section overrides, which is why a web.config that ran fine on an older test server can fail on a newer production box with no visible edit. When you inherit a site you did not deploy, compare its configuration against a fresh web.config generated by the site's own install wizard on the target server.

Do not change applicationHost.config merely because the error page mentions it. IIS may only be naming that file as the definition source for the locked section; the actual edit could sit in a child web.config. Confirm which file the "Config File" line names before opening an editor.

Malformed XML in web.config: Validate the File and Fix the Line

The most direct fix is a validation loop that never touches the live site. Copy the suspect web.config to a test folder, open it in an XML-aware editor, and run the file through a parser. Visual Studio and free editors like Notepad++ with an XML plugin both flag unclosed tags and stray ampersands. Alternatively, run dotnet or PowerShell's [xml](Get-Content .\web.config) to have the runtime itself parse the file; if it throws, the exception message names the line.

1: Copy the site's web.config to a scratch folder and keep a dated backup in the same operation — a .bak suffix beside the original is enough. 2: Open the copy in an XML editor and run validation; note the first reported line and character position. 3: Fix only that first error, save the file, and re-run validation before looking for the next fault, because one malformed section often produces a cascade of spurious reports. 4: Compare the repaired file against the server's baseline copy of web.config to spot copy-paste additions that are valid XML but invalid for this IIS version. 5: Restore the repaired file to the site folder, recycle the application pool, and test the URL in a private browser window so cached error pages do not mislead you.

The most common hidden culprits are an unclosed <system.webServer> block, an ampersand that should be & inside a connection string, and stray < or > characters that arrived with a copy-pasted rewrite rule. Two less obvious ones deserve mention: an empty tag written as that a colleague thought was harmless, and whitespace in an element name. Both parse as text to a human and fail the parser.

If the file passes validation but the site still shows 0x8007000D, the failure may sit in a parent web.config above the site. IIS walks up the folder tree and merges every web.config it finds, so a sibling application two folders up can break a site that is itself clean. Search upward from the broken site's root for every web.config and validate them all in the same pass. When you find the faulty one, repair it the same way.

The duplicate-entry variant deserves separate handling. A section such as httpErrors defined in both the site web.config and a parent file produces error code 0x800700B7 rather than 0x8007000D, and the fix is to remove the duplicate from the child file so the inherited definition applies once. Never "fix" it by deleting the server-level copy, because every other site inherits from it.

Permissions and Identity: Why a Valid File Still Fails

A web.config that parses cleanly can still fail with 0x80070005 when the worker process identity cannot read the file or traverse to it. IIS 7.5 and later assign application pools a virtual identity (such as IIS AppPool\MyAppPool), and that identity needs NTFS read permission on web.config plus execute-traverse permission on every folder above it. An administrator who moves a file with Explorer and preserves the source machine's permissions may quietly strip the server identity's access.

The test is small and non-destructive: open the site folder's Properties, check the Security tab, and confirm the pool identity or the IIS_IUSRS group appears with at least Read. If it does not, grant Read at the site folder and check that inheritance is enabled. Do not grant full control across an entire drive to save time — restrict the grant to the deployment folder and the specific application pool identity.

A second identity failure arises from the pool's own configuration rather than the file. If the pool is set to run as a custom account that no longer exists or has been disabled, every request that touches configuration can fail even though the file is readable as administrator. Look at the application pool's "Identity" setting and confirm the configured account is enabled and holds the required rights. Renaming an Active Directory account without updating the pool is a classic way to manufacture this error on a server that ran perfectly for months.

Editing the file itself can also fail after the pool has cached it. When you save a web.config fix, IIS recycles the pool on the next request and re-reads the file, but a locked-down deployment tool may still hold an old copy in a shadow path. Save with a fresh timestamp, and if the error persists, confirm you edited the copy IIS actually reads and not a deployment artifact in a staging folder.

Unlock Locked Sections Without Breaking Other Sites

Error code 0x80070021 means the web.config is well-formed and readable but attempts to set a section that applicationHost.config does not permit at site level. The classic example is a site-level <system.webServer> override that IIS allows only at server level by default. The lock is expressed through overrideModeDefault="Deny" on the section definition, and the right fix is to change the lock at the server level rather than to keep fighting the child file.

Section Where the lock is defined Common locked examples Right way to loosen it
system.webServer > security applicationHost.config, per-section entries , overrides Edit overrideModeDefault for that section, or use a location tag
system.webServer > modules Same Site-specific module additions Unlock modules or configure at server level only
system.webServer > handlers Same Custom handler mappings Unlock handlers or declare the mapping in the server file
system.web > httpRuntime Same Site-specific request limits Unlock at server level, then set in the site file

The safest structure inherits as much as possible and overrides narrowly. If only one site needs a different rule, wrap the change in a element rather than unlocking the section globally. An accidental global unlock can change behaviour for every site in the same application pool, including production ones you forgot about, which is why this edit deserves a second pair of eyes and a backup of applicationHost.config.

The edit itself is a one-line change in applicationHost.config, which sits in %windir%\system32\inetsrv\config. Find the section's element under , change overrideModeDefault="Deny" to "Allow", and recycle the pool. After a change of this kind, test every site on the server, not just the one you were repairing. The risk of a shared-config edit is invisible fallout elsewhere.

If the locked section appears in a shipped product rather than your own code, check the product's documentation before unlocking anything. Many vendor applications require a specific lock state and will fail differently if you loosen it. In that case, configure the section at server level and leave the site file alone, which keeps both the vendor application and your own site happy.

The Log Trail: Event Viewer, IIS Logs, and Failed Request Tracing

The error page tells you what failed, and the log trail tells you when and how often, which matters when the error is intermittent. Three places carry this evidence. Event Viewer's Windows Logs > Application log records ASP.NET and IIS configuration errors with timestamps and, often, the request URL that triggered them. IIS's own log files under %SystemDrive%\inetpub\logs\LogFiles record the HTTP status code for every request, so you can count how many 500.19 responses occurred and confirm whether the fault began at a deployment event.

Failed Request Tracing gives the deepest view. Enable it in IIS Manager for the site, define a trace rule that captures status codes 500 through 599, and reproduce the error. The resulting trace file traces the configuration step that failed, including the section name and the file path IIS was reading at that moment. This is the single best way to catch a fault that does not show on the first page load and to prove which web.config in a merged tree was involved.

A deployment timeline is often the fastest diagnosis of all. If the error began the same minute a deploy finished, the deploy changed either the site folder, a machine-level configuration, or the application pool identity settings — all three are visible in the deployment tool's own record. Move the deploy one folder up and locate exactly what it touched. If the error began with no deploy at all, suspect a scheduled task or a remote administration tool that edited configuration on the server's behalf.

Before going deeper, capture the evidence you will want later: screenshot the error page, note the error code, config file path, and line number, and record the UTC time of the failure. That combination lets you line up the event log and the trace file without arguing about time zones.

A Safe Repair Sequence That Keeps the Site Available

Work in this order to avoid a one-error-per-reload loop:

1: Note the error code and config file path from the error page, then copy the current web.config to a dated backup folder. 2: Validate the copy with an XML parser, fix the first reported fault, and re-validate until the copy is clean. 3: Restore the repaired file, recycle the application pool, and test the URL in a private window; capture any new error code. 4: If a permission code appears, grant the application pool identity read access on the site folder only, then retest. 5: If a lock code appears, edit applicationHost.config only after backing it up, then test every sibling site. 6: Only after the site responds normally, delete the scratch copies and record what changed.

The failure handling is equally structured. If the site goes down again after a repair, restore the dated backup first and treat the new fault as fresh rather than editing on top of earlier changes — stacked edits make a clean diagnosis impossible. If the error clears after recycling the pool but returns after the next content deployment, look at the deployment tool's configuration transform, which is the usual source of recurring reintroduced faults.

Schedule maintenance windows for changes that touch machine-level configuration. Site-level repairs can often be done safely with the pool recycling on save, but applicationHost.config edits affect every site and deserve an out-of-hours test window and a named person responsible for the change. Keep the change ticket with the file backup attached so a future operator can reconstruct what was done.

Preventing the Error With Deployment Practices

Most 500.19 incidents are deployment hygiene failures rather than server faults, and the preventive controls are unglamorous. Keep a known-good baseline web.config in source control and diff every deployment build against it. Run the XML validator as part of the build pipeline, not on the live server. Use the deployment tool's configuration transforms for environment differences instead of hand-editing production files, and never copy web.config between machines with Explorer drag-and-drop.

A second control is environment parity. If a staging server runs IIS 10 on Windows Server 2019 and production runs IIS 8.5 on Server 2012 R2, some sections will behave differently. Align the configuration sources across environments where you can, and document where they must differ. The error page reads its locked-section information from the local applicationHost.config, so the same site file can pass on one server and fail on another with no changes on its own side.

The third control is least-privilege permission templates. Grant read and traverse on the site folder at provisioning time, and reapplying the same ACL during deployment is safer than granting extra rights to fix an error. Keep an inventory of which application pool identity holds which access, and audit it when the team changes.

Finally, add a post-deployment verification step. After each deploy, load the site's home page, a deep link, and a static file, and read the status codes from the IIS logs, not the browser. A 500.19 caught by a monitoring check is a minute of work; one diagnosed by a user is an outage with a reputational cost.

FAQ

Is error 500.19 a problem with the page itself?

No — it's a configuration fault, and the page usually works once the configuration is valid. The error code proves this: 0x8007000D is an XML parse failure, and a page with a syntax error in it would still be reached after configuration succeeds. If you suspect both kinds of failure, fix configuration first and re-test before chasing application code. The same page can fail 500.19 forever without its own code being touched.

Can one site's web.config break another site on the same server?

Yes, indirectly. A web.config in a parent folder is inherited by every sub-application, and an edit to that parent file can trigger the error on dozens of sites at once, even though each site's own file is valid. The inverse is also true: a machine-level lock or a malformed server file can surface a site's own error page mentioning a child config file that is perfectly clean. Always trace the "Config File" path to its real location.

Why does the error appear on old Windows Server versions but not IIS 10?

IIS 7.5 and earlier shipped with somewhat different default section locks, and older Windows Server builds may read a partially malformed file more permissively if the bad section is never requested. A site that ran on an older test server can therefore fail on a newer production server with no visible edit on either side. Compare the applicationHost.config values for overrideModeDefault on the relevant section in both environments; that comparison usually explains the difference.

How long does a web.config repair take before the site is back?

For a single malformed line, the out-of-hours repair can run in under fifteen minutes once the file is copied to a scratch folder — validation and a single edit usually complete in under five, with the rest of the time spent recycling the pool and retesting. A locked-section change is longer because it touches machine-level configuration and demands a test on sibling sites. Intermittent faults take longest because they need a tracing session to reproduce.

Does the error break the site for every visitor or only some?

It breaks the site for every request that reads the affected configuration path, which in nearly every case means every visitor. Exceptions occur when the fault is only reachable on a path that IIS resolves differently, such as a site bound to two hostnames where only one hostname's configuration branch has the bad file. In that case, a staging URL can work while the production hostname fails, which is a useful diagnostic clue.

Is the "Cannot add duplicate collection entry" message the same error?

It's a sibling fault with its own code, 0x800700B7, and different remediation: identify the duplicated section in both the site and parent files, then delete the child copy so the inherited definition applies. The error page's code is the discriminator; do not apply the XML-validation fix blindly to a duplicate-entry code, because the file will validate cleanly and the fault will remain.

Can I fix 500.19 without editing any web.config file?

Sometimes yes — a locked section can be satisfied by moving the setting to server level, and a permission fault can be fixed by granting read access without touching file contents. If the fault is malformed XML, however, some file must change. The error page's "Config Source" block is the only reliable way to know which option is open to you before you start editing.

If this article helped you resolve the issue, sharing it with your team or leaving a comment about your specific error code and environment would go a long way toward helping others in the same situation.