U4-8406 - web.config no longer able to be read-only in production

Created by Paul Gower 03 May 2016, 20:01:27 Updated by Shannon Deminick 04 May 2016, 14:52:00

Tags: Unscheduled

Is duplicated by: U4-8405

Relates to: U4-8043

Relates to: U4-8405

@zpqrtbnk worked on [http://issues.umbraco.org/issue/U4-8043 this bug (U4-8043)]; however, the solution which is checked into this [https://github.com/umbraco/Umbraco-CMS/pull/1186 pull request] causes an issue if you have the web.config file set to read-only. According to the [https://our.umbraco.org/wiki/reference/files-and-folders/permissions/ permissions wiki] we should be able to set the web.config to read-only after install for enhanced security. This used to work until the above pull request was merged into 7.4.2.

The issue has to do with the call to the RestartApplicationPool method in the BindModel method. Since the RestartApplicaitonPool uses the File.SetLastwriteTimeUtc method to touch the web.config, it throws a System.UnauthorizedAccessException when the web.config is set to read-only access.

169 ApplicationContext.Current.RestartApplicationPool(new HttpContextWrapper(context));

27 File.SetLastWriteTimeUtc(configPath, DateTime.UtcNow);


Paul Gower 03 May 2016, 21:39:49

Looks like Stephan created his bug minutes before mine.

Stephan 04 May 2016, 06:41:41

RestartApplicationPool touches web.config which causes issues if it is read-only + that was for PartialTrust which we don't support anymore, should just unload the app domain!

Stephan 04 May 2016, 06:47:30

PR: https://github.com/umbraco/Umbraco-CMS/pull/1253

Review: code review, to test... install Umbraco, as the install does restart.

Priority: Major

Type: Bug

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.4.2, 7.4.3

Due in version: 7.5.0

Sprint: Sprint 14

Story Points: