Click here to Skip to main content
Click here to Skip to main content
Go to top

Prevent Visual Studio Crash When Debugging MVC Web Applications

, 28 Aug 2014
Rate this:
Please Sign up or sign in to vote.
Here is a tip for making sure that debugging your MVC website does not cause Visual Studio to crash when using IIS7 to host the site in your development environment: Don't use more than one worker. process in your Application pool.

Introduction

Prevent Visual Studio crashes when working with MVC web applications.

Background

Recently, I was trying to debug a MVC 5 web application in Visual Studio 2012. However, every time I would try to debug it, Visual Studio would crash. If I put the build into release mode, then I could run the application (but not debug it). I was using IIS7 to host the site in my local development environment. I realized that the issue happened when I was working on a production issue and it came to me that I had been experimenting with running the application pool as a web garden, which is to say more than 1 worker process.

The Cause

The cause is, the best I can determine the fact that I had the application pool set to have 7 worker processes and had several users logged into the site. When debugging the web application, Visual Studio has to attach to the work process. When there is more than one running, Visual Studio seems to not know which one to attach to, or it seems to attach to the wrong one which results in an error condition that causes Visual Studio to crash.

The Solution

To resolve the issue, I went into IIS 7, found the application pool in question under application pools and went into advanced properties. Find the setting for Maximum worker processes. In my case, I had it set to 7. I set it back to 1, restarted the application pool and went into Debug mode and voila! Debugging successful!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Aaron L. Hall
Technical Lead
United States United States
Software Engineer IT Team lead with over 11 years application development experience, over 15 years IT experience.
 
Proficient Technologies / languages
Experienced in .NET, C#, MVC, Web Services, Windows Services, Entity Framework, SQL, ADO.NET and more.
 
Dabbles in
Android, java, Linux and most things computer related.
Follow on   LinkedIn

Comments and Discussions

 
GeneralMy vote of 5 PinmemberHumayun Kabir Mamun28-Aug-14 18:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 28 Aug 2014
Article Copyright 2014 by Aaron L. Hall
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid