Wednesday, September 2, 2015

Debugging 64-bit Web applications in Visual Studio

Imagine, you are developing a web application which is either itself a 64-bit (x64), or even use any x64 library. When you try to start debugging this application, you get an error message from the series BadImageFormatException.


And there is for the fact that IIS Express, used in Visual Studio for debugging, operates as a 32-bit process, as is easily seen by looking in the Task Manager:

And if you are using version Vsual Studio until 2012 the only way was to use for debugging the local "big" IIS, suitably adjust the properties of the project:

(screenshot from 2012 version, but in 2010 it is almost the same)

Starting from the 2012 version have the opportunity to make Visual Studio a little more intelligent and used for web projects x64 64-bit version of IIS Express. If you have a 2012 or 2013 studio, then, first of all make sure that IIS Express x64 installed (for that, see if you have the system directory C: \ Program Files \ IIS Express \).
If IIS Express x64 is not installed, then download it (from here: http://www.microsoft.com/ru-ru/download/details.aspx?id=34679) and install.

After that was the last step. Close the Visual Studio, if you have still not done so, start the console as an administrator and run the command corresponding to the version you have installed Visual Studio.

for Visual Studio 2012:

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

for Visual Studio 2013:

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

That's all. Now for the debugging of 64-bit Web applications will use a 64-bit version of IIS Express, which again is easily checked using Task Manager

By Unknown with No comments

0 коммент.:

Post a Comment