I was setting up an ASP.NET application in IIS 8 when this error message all of a sudden popped up:
Error: Cannot Write Configuration File due to Insufficient Permissions
I wasn’t sure what was going on at first… why was IIS saying it didn’t have the right level of permissions to write to a file? I couldn’t continue with the site setup since I was unable to change the default document settings in IIS or the .NET Authorization rules. The error would just keep showing.
I started trying to adjust all sorts of permissions before I realized: wait a second… could the ReadOnly setting be toggled on the Web.config file?
And that was exactly the problem. The Web.config file had been set to read-only. As soon as I clicked the read-only toggle off on this file, I was able to continue changing the settings that I needed to get the site up and running in IIS.
It would be nice if some of these Microsoft error messages could be more exact as to what problem is happening. This error had me wondering about permissions settings in the Web site folder/files, while the actual issue was a simple read-only setting on the Web.config file. If you ask me, Microsoft should just set this error as:
Error: Cannot Write to Configuration File due to Read-Only being set to true
There, isn’t that much clearer? The problem and the actual solution in one simple error message