10

I have been with VS2012 for a few years now. I developed my first asp.net/angularjs project under VS2012. Secondly, I recently checked out a VS2013 project (written by a 3rd party) which ran just fine under 2012.

Then it was suggested that I install VS2015 on my laptop. This is when things went wrong.

Problems: I attempted to load the new VS2013 project in VS2015, but it immediately failed to load.

VS2015 error:

Creation of the virtual directory http://localhost:32999/ 
failed with the error: Filename: redirection.config
Error: Cannot read configuration file

Now when I go back to VS2012 and load my original asp.net/angular project, I get this error:

Error loading vs2012 project

So in the end, I can't load any projects at all ! Neither 2012 nor 2015.

My local IIS websites are still running fine, by the way, but not the local dev environments.

How can I fix these virtual directories ?

Thanks in advance, Bob

bob.mazzo
  • 5,183
  • 23
  • 80
  • 149
  • I found that this error was caused by my project being on a share drive under a virtual machine. Copying the project to the local C drive and opening resolved the problem for me. – Peter H Apr 17 '19 at 10:11

4 Answers4

19

As per some guidance from this post - IISExpress 8 Cannot read configuration file redirection.config, here's how I got my VS2015 to load up successfully:

  • Close VS2015
  • Go into folder %userprofile%\Documents\IISExpress\config
  • Rename applicationhost.config
  • Restart VS and load the solution/project
  • VS should have recreated applicationhost.config, and project should load

Of course, I now have a different error, which I will post anew:

[BadImageFormatException: Could not load file or assembly 'MyWebApp.DAL' 
or one of its dependencies. An attempt was made 
to load a program with an incorrect format.]
Community
  • 1
  • 1
bob.mazzo
  • 5,183
  • 23
  • 80
  • 149
  • I think `BadImageFormatException` is specific to the user. Deleting the applicationhost config file from this location solved my issue. – Ankur-m Mar 13 '19 at 16:05
4

I resolved the same problem by starting visual studio with Administrator rights. This post pointed me in the right direction and gives more solutions.

Tom
  • 874
  • 7
  • 13
3

This may be due to checked-in applicationhost file. Delete the file from the repository. Build the project again. This file will be created automatically. Don't check in this config file again.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
Neha K
  • 31
  • 2
1

This won't work for everyone, but in my case, the file that couldn't be written was actually a temp file in C:\users\\AppData\Local\Temp\iisexpress. We were getting a company wide virus attack and they shut this area down for everyone. They were able to change the policy just for me and that fixed it.