IIS supports sharing the configuration across multiple web servers. In some cases, you may come across “Configuration file is not well-formed XML” or “Cannot read configuration file” errors in Event Viewer.
These error messages indicate that IIS shared config environment is having difficulties syncing the data. This may stop the application pool which means an outage for your application.
Check both System and Application containers in Event Viewer to have more details about issue:
5172: The Windows Process Activation Service encountered an error trying to read configuration data from file applicationHost.config line number 0. The error message is: ‘Cannot read configuration file’. The data field contains the error number.
2307: The worker process for application pool abc.com encountered an error ‘Configuration file is not well-formed XML’ trying to read configuration data from file abc.config, line number 3. The data field contains the error code.
“Cannot read configuration file”
“Configuration file is not well-formed XML”
As this article mentions, DFS deletes the current configuration file and creates every time there is a change in the IIS shared environment. During this process, a member server may retrieve an incomplete config file.
The fastest solution is that changing the value of the ConfigPollMilliSeconds
parameter to 600000
so that IIS doesn’t rely on file system change notifications. It automatically checks the last modified date of the configuration file every 600000 milliseconds (10 minutes) with this setting. More details: Microsoft Support
The registry key: HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\ConfigPollMilliSeconds
(REG_DWORD). Restart the server after changing the value of this registry key.
You can try using Offline Files for the IIS shared folder. If it is production environment, please implement this change after business hours and monitor the system. The changes should be synced and websites are served without any issues.
REG ADD "HKLM\System\CurrentControlSet\Services\CSC\Parameters" /v ReadOnlyCache /t REG_DWORD /d 1 /f
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.