U4-5783 - [Umbraco 7.1.8] applications.config & trees.config cannot be Read-only?

Created by Alvin 11 Nov 2014, 09:17:44 Updated by Shannon Deminick 26 Jun 2017, 06:50:57

Relates to: U4-6030

Relates to: U4-5126

when an Umbraco 7.1(.8) installation is source controlled (by TFS), files will be marked Read-only at file level (when checked-in). Umbraco will then throw an Access denied exception on applications.config & trees.config because it wants to open the files in Write mode (without actually writing changes?). Only when those two files are checked-out or i manually remove the Read-only flag on file level (which is the same), Umbraco will then run fine.

Umbraco 6 does not have this problem.

it seems like Umbraco does a LoadXml with wrong File access mode?

[UnauthorizedAccessException: Access to the path 'c:\inetpub\wwwroot\Umbraco71\config\applications.config' is denied.] System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +217 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1305 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +60 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) +54 System.Xml.XmlWriterSettings.CreateWriter(String outputFileName) +155 System.Xml.XmlWriter.Create(String outputFileName, XmlWriterSettings settings) +23 System.Xml.Linq.XDocument.Save(String fileName, SaveOptions options) +118 Umbraco.Core.Services.SectionService.LoadXml(Action1 callback, Boolean saveAfterCallback) +217 Umbraco.Core.Services.SectionService.Initialize(IEnumerable1 existingSections) +68 umbraco.BusinessLogic.ApplicationRegistrar.ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) +298 Umbraco.Core.ApplicationEventHandler.OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) +37 Umbraco.Core.CoreBootManager.b__5(IApplicationEventHandler x) +19 Umbraco.Core.EnumerableExtensions.ForEach(IEnumerable1 items, Action1 action) +141 Umbraco.Core.CoreBootManager.Complete(Action1 afterComplete) +94 Umbraco.Web.WebBootManager.Complete(Action1 afterComplete) +38 Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) +157 Umbraco.Core.UmbracoApplicationBase.Application_Start(Object sender, EventArgs e) +9

[HttpException (0x80004005): Access to the path 'c:\inetpub\wwwroot\ Umbraco71\config\applications.config' is denied.] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9936485 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Access to the path 'c:\inetpub\wwwroot\ Umbraco71\config\applications.config' is denied.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9950728 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254


Rob 11 Nov 2014, 09:41:54

I have exactly the same issue. Those 2 files (applications.config & trees.config) need to be checked out every time, or read-only flag has to be removed to be able to run umbraco.

Eric Gaspard 18 Dec 2014, 08:29:06

I believe these two files need to be readable/check-out on the first launch of the application after that it seems to not need to write on these files (I'm also using TFS and currently these files are not checked out on me environment).

This is due to the fact that Applications or Trees can be declared programmatically (i.e. using Attributes) and Umbraco will reflect those in said configuration files if needed. Therefore if you were to create a new Application or a Custom Tree for the Back-Office, these files will need to writable the first time you reload your website.

In my experience, Umbraco is very "write-hungry", be it config files, views, static files, macros or whatever you can modify using the Back-Office editors, which can be a pain with TFS since the Back-Office do not send check-out commands before editing obviously.

My advice is to be forward-thinking with checking out the files you know that will need to be modified by Umbraco. Also do not source-control the '''App_Data''' folder and the '''Media''' folder.

Shannon Deminick 26 Jun 2017, 06:50:58

Closing issue due to inactivity - see blog post for details https://umbraco.com/blog/issue-tracker-cleanup/

Priority: Normal

Type: Bug

State: Closed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:


Story Points: