Home
%3CLINGO-SUB%20id%3D%22lingo-sub-334361%22%20slang%3D%22en-US%22%3EConfiguration%20file%20related%20errors%20in%20a%20shared%20IIS%20environment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-334361%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22margin%3A%200in%200in%207.5pt%200in%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2013.5pt%3B%20font-family%3A%20'Arial'%2Csans-serif%3B%20color%3A%20%236b6b6b%3B%22%3EIIS%20supports%20sharing%20the%20configuration%20across%20multiple%20web%20servers.%20In%20some%20cases%2C%20you%20may%20come%20across%20%E2%80%9C%3CSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20'Arial'%2Csans-serif%3B%22%3EConfiguration%20file%20is%20not%20well-formed%20XML%3C%2FSPAN%3E%3C%2FSTRONG%3E%E2%80%9D%20or%20%E2%80%9C%3CSTRONG%3ECannot%20read%20configuration%20file%3C%2FSTRONG%3E%E2%80%9D%20errors%20in%20Event%20Viewer.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%200in%207.5pt%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%200in%207.5pt%200in%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2013.5pt%3B%20font-family%3A%20'Arial'%2Csans-serif%3B%20color%3A%20%236b6b6b%3B%22%3EThese%20error%20messages%20indicate%20that%20IIS%20shared%20config%20environment%20is%20having%20difficulties%20syncing%20the%20data.%20This%20may%20stop%20the%20application%20pool%20which%20means%20an%20outage%20for%20your%20application.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20margin%3A%200in%200in%207.5pt%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20margin%3A%200in%200in%207.5pt%200in%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2013.5pt%3B%20font-family%3A%20'Arial'%2Csans-serif%3B%20color%3A%20%236b6b6b%3B%22%3ECheck%20both%26nbsp%3B%3CSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20'Arial'%2Csans-serif%3B%22%3ESystem%26nbsp%3B%3C%2FSPAN%3E%3C%2FSTRONG%3Eand%26nbsp%3B%3CSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20'Arial'%2Csans-serif%3B%22%3EApplication%26nbsp%3B%3C%2FSPAN%3E%3C%2FSTRONG%3Econtainers%20in%20Event%20Viewer%20to%20have%20more%20details%20about%20issue%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%20style%3D%22margin%3A%200in%200in%207.5pt%200in%3B%22%3E%3CSTRONG%3E%3CSPAN%20style%3D%22font-size%3A%2013.0pt%3B%20font-family%3A%20'Arial'%2Csans-serif%3B%20color%3A%20%236b6b6b%3B%22%3E5172%3A%26nbsp%3B%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-size%3A%2013.0pt%3B%20font-family%3A%20'Arial'%2Csans-serif%3B%20color%3A%20%236b6b6b%3B%22%3EThe%20Windows%20Process%20Activation%20Service%20encountered%20an%20error%20trying%20to%20read%20configuration%20data%20from%20file%20applicationHost.config%20line%20number%200.%20The%20error%20message%20is%3A%20%E2%80%98Cannot%20read%20configuration%20file%E2%80%99.%20The%20data%20field%20contains%20the%20error%20number.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20margin%3A%200in%200in%207.5pt%200in%3B%22%3E%3CSTRONG%3E%3CSPAN%20style%3D%22font-size%3A%2013.0pt%3B%20font-family%3A%20'Arial'%2Csans-serif%3B%20color%3A%20%236b6b6b%3B%22%3E2307%3A%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-size%3A%2013.0pt%3B%20font-family%3A%20'Arial'%2Csans-serif%3B%20color%3A%20%236b6b6b%3B%22%3E%26nbsp%3BThe%20worker%20process%20for%20application%20pool%20abc.com%20encountered%20an%20error%20%E2%80%98Configuration%20file%20is%20not%20well-formed%20XML%E2%80%99%20trying%20to%20read%20configuration%20data%20from%20file%20abc.config%2C%20line%20number%203.%20The%20data%20field%20contains%20the%20error%20code.%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20500px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F72632i5DDCFC8B5CE37671%2Fimage-dimensions%2F500x306%3Fv%3D1.0%22%20width%3D%22500%22%20height%3D%22306%22%20alt%3D%22bb1.jpg%22%20title%3D%22bb1.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%E2%80%9CCannot%20read%20configuration%20file%E2%80%9D%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20500px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F72633i3B2BCAC4CB0E33F0%2Fimage-dimensions%2F500x367%3Fv%3D1.0%22%20width%3D%22500%22%20height%3D%22367%22%20alt%3D%22bb2.jpg%22%20title%3D%22bb2.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%E2%80%9CConfiguration%20file%20is%20not%20well-formed%20XML%E2%80%9D%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1676103098%22%20id%3D%22toc-hId-1761187219%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--876053863%22%20id%3D%22toc-hId--790969742%22%3ESolution%3C%2FH2%3E%0A%3CP%3EAs%20%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fblogs.msdn.microsoft.com%252Fasiatech%252F2013%252F12%252F01%252Fyou-may-experience-configuration-file-is-not-well-formed-xml-error-while-using-dfsr-to-synchronize-the-iis-configuration-files%252F%26amp%3Bdata%3D02%257C01%257CNedim.Sahin%2540microsoft.com%257C92a39df299d64863d16508d68e209565%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C636852667928292548%26amp%3Bsdata%3D9Igr8oJCe%252B7JMaZLEe6gFnlmrRTmVJkTWaYuW1V9EFw%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethis%20article%3C%2FA%3E%20mentions%2C%20DFS%20deletes%20the%20current%20configuration%20file%20and%20creates%20every%20time%20there%20is%20a%20change%20in%20the%20IIS%20shared%20environment.%20During%20this%20process%2C%20a%20member%20server%20may%20retrieve%20an%20incomplete%20config%20file.%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId-473729462%22%20id%3D%22toc-hId-558813583%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22toc-hId--2078427499%22%20id%3D%22toc-hId--1993343378%22%3ESolution%201%3C%2FH4%3E%0A%3CP%3EThe%20fastest%20solution%20is%20that%20changing%20the%20value%20of%20the%3CCODE%3EConfigPollMilliSeconds%3C%2FCODE%3E%20parameter%20to%20%3CCODE%3E600000%3C%2FCODE%3E%20so%20that%20IIS%20doesn%E2%80%99t%20rely%20on%20file%20system%20change%20notifications.%20It%20automatically%20checks%20the%20last%20modified%20date%20of%20the%20configuration%20file%20every%20600000%20milliseconds%20(10%20minutes)%20with%20this%20setting.%20More%20details%3A%20%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttp%253A%252F%252Fsupport.microsoft.com%252Fkb%252F954864%252Fen-us%26amp%3Bdata%3D02%257C01%257CNedim.Sahin%2540microsoft.com%257C92a39df299d64863d16508d68e209565%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C636852667928292548%26amp%3Bsdata%3DcEJ59%252FXzzoSRVwc1%252BE0pjJIIeFWrOxxi0oG15R0kTr0%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft%20Support%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThe%20registry%20key%3A%20%3CCODE%3EHKLM%5CSystem%5CCurrentControlSet%5CServices%5CW3SVC%5CParameters%5CConfigPollMilliSeconds%3C%2FCODE%3E%20(REG_DWORD).%20Restart%20the%20server%20after%20changing%20the%20value%20of%20this%20registry%20key.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20500px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F72634i9B4832356C5E6064%2Fimage-dimensions%2F500x192%3Fv%3D1.0%22%20width%3D%22500%22%20height%3D%22192%22%20alt%3D%22bb3.jpg%22%20title%3D%22bb3.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--335617164%22%20id%3D%22toc-hId--250533043%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22toc-hId-1407193171%22%20id%3D%22toc-hId-1492277292%22%3ESolution%202%3C%2FH4%3E%0A%3CP%3EYou%20can%20try%20using%26nbsp%3B%3CSTRONG%3EOffline%20Files%26nbsp%3B%3C%2FSTRONG%3Efor%20the%20IIS%20shared%20folder.%20If%20it%20is%20production%20environment%2C%20please%20implement%20this%20change%20after%20business%20hours%20and%20monitor%20the%20system.%20The%20changes%20should%20be%20synced%20and%20websites%20are%20served%20without%20any%20issues.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EIn%20Control%20Panel%2C%20open%20%E2%80%9C%3CSTRONG%3EOffline%20Files%3C%2FSTRONG%3E%E2%80%9D%3C%2FLI%3E%0A%3CLI%3EClick%20%E2%80%9C%3CSTRONG%3EEnable%20Offline%20Files%3C%2FSTRONG%3E%E2%80%9D%3C%2FLI%3E%0A%3CLI%3ERun%20the%20following%20command%20in%20Command%20Prompt%20to%20set%20the%20cache%20Read%20Only%26nbsp%3B%3CBR%20%2F%3E%3CCODE%3EREG%20ADD%20%22HKLM%5CSystem%5CCurrentControlSet%5CServices%5CCSC%5CParameters%22%20%2Fv%20ReadOnlyCache%20%2Ft%20REG_DWORD%20%2Fd%201%20%2Ff%3C%2FCODE%3E%3C%2FLI%3E%0A%3CLI%3ERestart%20the%20web%20server%3C%2FLI%3E%0A%3CLI%3EGo%20to%20the%20file%20share%20folder.%20Right%20click%20and%20select%20%E2%80%9C%3CSTRONG%3EAlways%20Available%20Offline%3C%2FSTRONG%3E%E2%80%9D%3C%2FLI%3E%0A%3CLI%3EGo%20to%20%E2%80%9C%3CSTRONG%3EControl%20Panel%20%26gt%3B%20Offline%20Files%3C%2FSTRONG%3E%E2%80%9D.%20Select%20%E2%80%9C%3CSTRONG%3ESchedule%3C%2FSTRONG%3E%E2%80%9D%3C%2FLI%3E%0A%3CLI%3ESchedule%20offline%20file%20sync%3C%2FLI%3E%0A%3C%2FOL%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-334361%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%236b6b6b%3B%20font-family%3A%20%26amp%3Bquot%3B%20arial%26amp%3Bquot%3B%2Csans-serif%3B%20font-size%3A%2013.5pt%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EIIS%20supports%20sharing%20the%20configuration%20across%20multiple%20web%20servers.%20In%20some%20cases%2C%20you%20may%20come%20across%20%E2%80%9C%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20font-weight%3A%20bold%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3EConfiguration%20file%20is%20not%20well-formed%20XML%3C%2FSPAN%3E%3C%2FSTRONG%3E%E2%80%9D%20or%20%E2%80%9C%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20font-weight%3A%20bold%3B%22%3ECannot%20read%20configuration%20file%3C%2FSTRONG%3E%E2%80%9D%20errors%20in%20Event%20Viewer.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft

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.

bb1.jpg

“Cannot read configuration file”

bb2.jpg

“Configuration file is not well-formed XML”

 

Solution

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.

 

Solution 1

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.

 

bb3.jpg

 

Solution 2

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.

  1. In Control Panel, open “Offline Files
  2. Click “Enable Offline Files
  3. Run the following command in Command Prompt to set the cache Read Only 
    REG ADD "HKLM\System\CurrentControlSet\Services\CSC\Parameters" /v ReadOnlyCache /t REG_DWORD /d 1 /f
  4. Restart the web server
  5. Go to the file share folder. Right click and select “Always Available Offline
  6. Go to “Control Panel > Offline Files”. Select “Schedule
  7. Schedule offline file sync