title: Visual Studio regularly freezes running Microsoft.VisualStudio.Web.Host.exe
body: <h3>Background</h3>
  <p>I maintain several web sites that are Visual Studio &quot;Web Site Projects&quot;.</p>
  <h3>Problem</h3>
  <p>I've found that with <em>a couple of</em> these projects, Visual Studio regularly freezes while I'm working on the code. This doesn't happen for <em>some</em> of the web site projects, and I haven't seen it happen on any Web <em>Application</em> projects.</p>
  <h3>Symptoms</h3>
  <ul>
  <li>Each time it freezes, it takes about half a minute before I can use it again.</li>
  <li>During a freeze, Windows Task Manager reports that <code>Microsoft.VisualStudio.Web.Host.exe</code> is maxing out one of the CPU cores.</li>
  </ul>
  <h3>Steps to Reproduce</h3>
  <ol>
  <li>Open a <code>.cs</code> file under the <code>App_Code</code> directory.</li>
  <li>Make a change to the file.</li>
  <li>Save the file.</li>
  <li>Navigate somewhere else (eg switch tab, close the file, open different program in Windows).</li>
  <li>Navigate back to the file (eg switch tab to it, open it, or go back to Visual Studio).</li>
  </ol>
  <p>Other actions that sometimes seem to trigger the problem:</p>
  <ul>
  <li>&quot;Go to definition&quot;</li>
  <li>Opening a file</li>
  <li>Previewing a file</li>
  <li>Closing a file</li>
  <li>Using a refactoring</li>
  <li>&quot;Find usages&quot;</li>
  </ul>
  <h3>What I've Tried</h3>
  <ul>
  <li>Both Visual Studio 2012 and Visual Studio 2015</li>
  <li>Changing the website project's build action</li>
  <li>Disabling &quot;Build Web site as part of solution&quot;</li>
  <li>Deleting web references and the Bin folder seems to minimise the problem, but obviously this breaks the web site. Maybe web site projects experience this problem when they contain a lot of C# code other than code-behind files?</li>
  </ul>
  <h3>Similar problems</h3>
  <p>I found the following potentially-related problems using Google, but none of them seemed to contain a workaround or solution.</p>
  <ul>
  <li><a href="http://social.msdn.microsoft.com/Forums/vstudio/en-US/26938f5d-fc15-4836-80c1-9078302e01e0/microsoftvisualstudiowebhostexe-time-theft" rel="noreferrer">Microsoft.VisualStudio.Web.Host.exe Time Theft</a></li>
  <li><a href="https://connect.microsoft.com/VisualStudio/feedback/details/791804/microsoft-visualstudio-web-host-exe" rel="noreferrer">Microsoft.VisualStudio.Web.Host.exe</a></li>
  <li><a href="https://connect.microsoft.com/VisualStudio/feedback/details/820373/visual-studio-2012-freezes-for-approximately-30-seconds-after-every-build" rel="noreferrer">Visual Studio 2012 freezes for approximately 30 seconds after every build</a></li>
  </ul>