do.Develop();

this.AreaOfInterest = Development.All();

VS2012, IISExpress, migration of domainuser and network share = wtf?!

Update available, scroll down!

When I started working at my current employer I noticed that My Documents was mapped to a network share. That didn’t occur to me as a problem, at the moment.

Last week the IT department decided that it was a good idea to move users to a new domain and also avoid having My Documents stored on a network share. Now they should be stored in the regular c:\users\username\documents directory. Fine with me!

Alright, its just copy and paste you think 🙂

Problem

Here is the insane part that I still haven’t got working:

IISExpress stores the applicationhost.config file in your whatever My Documents/IISExpress/config directory. Visual Studio does the same thing with all your important WebApplication1 projects as well as other templates and settings. This is not that hard to move since you can reconfigure Visual Studio to point to the new location.

For IISExpress  the path to the applicationhost.config file is a little different since that is stored in some hidden path buried deep down inside IISExpress and makes use of the %USERPROFILE% environment variable(which of course I now have pointing to the c:\users\username directory). If you just move the file (and relocate the My Documents library) and try to start IISExpress with a command prompt, you end up with this:

“An error occurred while reading configuration information. Make sure that the configuration file \\?\UNC\server\users\jonas\_data\IISExpress\config\applicationHost.config exists, it is accessible, and contains valid configuration information.”

This is totally acceptable since IIS Express have this hidden storage with all the path’s that’s important in your life. I still would like to know where… Trust me, I have searched the registry a couple of times for this.

A solution to one part of the problem

On the other hand, this is quite easy to solve with a reinstall of IISExpress. After you’ve done that you can start it via command prompt again.

Here’s the bad, crazy, insane, reeeeally frustrating bits

When I open my solutionfile in Visual Studio (with projects that take advantage of IISExpress) I get this error message:

C:\whateverproject.csproj : error : Creation of the virtual directory http://localhost:54000/whatever failed with the error: Filename: \\?\UNC\server\users\jonas\_data\IISExpress\config\applicationHost.config
Error: Cannot read configuration file due to insufficient permissions

The old configurationfiles still resides on the network share and this error indicates that the “new” domain don’t have permissions to access it. I COULD resolve that by fixing the access but I don’t wan’t Visual Studio to use that file in the first place. WHY does Visual Studio still use that path for the configuration?

I have searched the registry both one and five times without finding it.
Also, looking at all the environment variables using a simple “set” does not give any path containing the network share.

Update

I’ve probably sent a dozen e-mail back and forth with Microsoft on the matter and yesterday I received this. It’s to bad there is no workaround, but always good to know that there is an issue (not only with my setup)

Hi Jonas,

This problem happened because of a bug on IISExpress.

When the CustomUserHome registry key value is configured, which is set by running IISExpress.exe with -userhome parameter, Visual Studio can’t get the right path from IISExpress and still get the wrong path of the user profile directory.

I have logged a product bug on that issue and reported to bug and the bug would be fixed in the next release of IISExpress.

When the bug is fixed, Visual Studio will work from the directory which is configured by the CustomUserHome registry key value and your problem will be solved. 

Unfortunately there is no work-around right now. So, until the bug is fixed, I’d like to recommend to remove the CustomUserHome registry key value and makes the “new” domain user have the access permission on the share as you said in your mail as the following.

November 13, 2012 - Posted by | ASP.NET, Development | , ,

3 Comments »

  1. Have you found a solution to this issue? I’m encountering a similar error.

    Comment by Jason M | November 26, 2012 | Reply

    • Figured out my issue… even though I changed the location of “My Documents” in the “documents library” within Windows 7; two registry settings were forcing IISExpress to search else where for the configuration files.

      Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal
      .. and ..
      Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal

      These were both pointing to a network share which I didn’t have access to. Once I changed these to point to my local “My Documents” folder, everything worked correctly.

      Good luck!

      Comment by Jason M | November 27, 2012 | Reply

  2. Jason M, you are the man! Thanks for your comment. I was researching this problem the whole day. I had a workaround to work with my MVC solution, but I did not want to constantly modify the csproj file all the time and exclude it from the source control. I also had ‘my documents mapped’ into a network folder in the registry that the local admin account did not have access to. Thanks again!!

    Comment by Luis S | January 23, 2014 | Reply


Leave a comment