Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Express 8 - Cannot write configuration file

I am trying to use IIS Express 8 for a MVC site in VS2012. I am getting the following error whenever I attempt to create the site:

Filename: \?\C:\Users\xxxxxx\Documents\IISExpress\config\applicationHost.config
Error: Cannot write configuration file

Is there some way to force IIS Express to use a different location for the config & logs folders? I understand I can point to a different location when I am running iisexpress.exe from the command line, but I have no control over this when using Visual Studio.

Alternatively, has anyone got any suggestions why the error is happening? (Side note: My laptop is in a corporate environment which has some stupid encryption on the "Documents" folder, however I haven't had any problems with other software that saves to this location. I also have given the "Everyone" group full access to the folder.)

EDIT - After following the instructions at http://learn.iis.net/page.aspx/1286/iis-80-express-readme/ I still can't seem to get this working. I've tried the following:

  • Added HKCU\Software\Microsoft\IISExpress\CustomUserHome registry key pointing to my alternate directory
  • Added HKCU\Software\Microsoft\IISExpress\8.0\CustomUserHome registry key pointing to my alternate directory
  • Added HKLM\Software\Microsoft\IISExpress\CustomUserHome registry key pointing to my alternate directory
  • Added HKLM\Software\Microsoft\IISExpress\8.0\CustomUserHome registry key pointing to my alternate directory
  • Setting the %IIS_USER_HOME% environment variable pointing to my alternate directory.

Any other suggestions?

like image 822
Brad Leach Avatar asked Jul 12 '12 04:07

Brad Leach


4 Answers

@Brad

I had your same problem just now. Removing the encryption on the IISExpress folder and the "Read Only" attribute solved it. In my company Documents is also encrypted, but I don't think removing that encryption from IISExpress would be a problem of any sort.

Hope this helps.

like image 94
Alejandro Nagy Avatar answered Oct 24 '22 07:10

Alejandro Nagy


I had a very similar error message caused by a completely different problem.

The Error:

C:\VS\TFS_Projects\SomeSolution\SomeProject\SomeProject.csproj : error : Creation of the virtual directory http://localhost:55063/ failed with the error: Filename: \\?\C:\VS\TFS_Projects\SomeSolution.vs\config\applicationhost.config Error: Cannot write configuration file due to insufficient permissions

More Details: I couldn't even open the project, as opening it would fail.

I could get prior changesets, and they would actually open fine, but if I got latest the projects couldn't be opened.

Solution: In my case, it turned out that when we changed TFS servers, someone had added the ".vs" folder to source control along with everything else. Under which, one developer had his applicationhost.config set up to run sites on a D:\ drive, while I had no such D:\ drive (well, it was a DVD drive.) I was able to get this working by finding a prior changeset with the un-altered applicationhost.config and replacing my local file. (I could have attempted to actually delete the folder, but I didn't go that route.)

Afterwards, we removed the ".vs" folder from source control.

(I put this solution here because it's where google landed me, so other people having this error message might find the above solutions don't fix it for them, and thus they might be having this problem.)

like image 41
Greg Avatar answered Oct 24 '22 05:10

Greg


I'm also in a corporate environment with Encryption on the users folder, and removing encryption and removing the read only flags on everything in the IISExpress folder worked for me.

like image 5
Sam Avatar answered Oct 24 '22 07:10

Sam


I'm using Visual Studio 2017 on Windows 10 and to fix this problem I had to disable the OneDrive setting "Save space and download files as you use them". After changing the setting my computer crashed but after rebooting I was then able to change SSL Enabled and everything worked.

like image 4
pwhe23 Avatar answered Oct 24 '22 05:10

pwhe23