Debugging VS2013 Websites Using 64-bit IIS Express

6 April 2016 Update: Added the correct values for VS2015.


 

If you are working on ASP.NET MVC web sites in Visual Studio 2013 (VS2013) or 2015 (VS2015), you need to make one registry change if you want to run IIS Express as a 64-bit process by default.  Use one of the methods, below.

Within VS2013 or VS2015:

Tools | Options | Projects and Solutions | Web Projects | Use the 64 bit version of IIS Express…

* Thanks to Christian Lundestad, David, Javier Collazo and Eliza for pointing this method out in the comments.

Command-Line:

For VS2013, use

 reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjects /v Use64BitIISExpress /t REG_DWORD /d 1

For VS2015, use

 reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\WebProjects /v Use64BitIISExpress /t REG_DWORD /d 1

Regedit:

  1. For VS2013, navigate to:

     HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjects
    
  2. For VS2015, navigate to:

     HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\WebProjects
    
  3. Make sure there is a REG_DWORD value named “Use64BitIISExpress”.  If not, create it.

  4. Set its value from 1 (default = 0).

That’s it.  Now you can debug your 64-bit web sites.

If you don't do this, you will likely get a message similar to:

"Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format."

I found this solution for Visual Studio 2012 (VS2012) on Stack Overflow here.

Rob