Can’t write to applicationhost.config

While running Visual Studio 2015 as well as 2017 I’ve come across the following error running Web projects with IISExpress:

2017-04-03 21_30_15-applicationhost.config

—————————
Microsoft Visual Studio
—————————
The following error occurred when trying to configure IIS Express for project MvcClient. Filename: \\?\C:\Project\.vs\config\applicationhost.config
Error: Cannot write configuration file
—————————
OK
—————————

I did some digging found with Sysinternals Process Monitor and found a bunch of SHARING VIOLATION file access errors on the file. Searching a bit deeper for the first record for that file, I found a record with the result EFS NOT ALLOWED IN TRANSACTION. Okay, now I was on to something:

2017-04-03 21_33_25-Process Monitor - Sysinternals_ www.sysinternals.com.png

EFS Stands for Encrypting File System. This is a Windows feature that allows you to encrypt specific files or folders. You enable this via the Windows Explorer properties box under the Advanced button.

I remembered that a while ago that I enabled EFS on some of my data because I can’t use BitLocker drive encryption on this machine. Unfortunately BitLocker isn’t a practical option because I’m running Windows 10 on a MacBook pro via Bootcamp.

Turns out the fix was as simple as disabling EFS for the relevant .vs folders!

2017-04-03 21_44_39-Advanced Attributes

Unfortunately I still don’t know why EFS wasn’t “allowed” as per the original message. It looks like Visual Studio did manage to create the file, so I don’t know the reason it complains at run-time. For know I don’t really care though, as it’s easy enough to disable EFS. I’ll continue using EFS overall, just disabling it on the .vs folders which don’t contain anything I don’t mind losing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s