While running Visual Studio 2015 as well as 2017 I’ve come across the following error running Web projects with IISExpress:
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
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:
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!
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.
Thank you so very much! I was getting super frustrated and was struggling with this for weeks! I did everything.. regedit, config edit etc but nothing worked. This did! and it was such a simple fix! Thank you!
this really helped me. thanks.