title: How to repair IISExpress that wont compile simple application?
body: <p>If I create a new empty MVC application, add a controller and a view and then run I get a compile error which appears to be from IISExpress  as it doesn't show as an error in Visual Studio.</p>
  
  <blockquote>
    <p>Server Error in '/' Application.</p>
    
    <p>Compilation Error</p>
    
    <p>Description: An error occurred during the compilation of a resource
    required to service this request. Please review the following specific
    error details and modify your source code appropriately.             </p>
    
    <p>Compiler Error Message: BC30451: 'ViewData' is not declared. It may be
    inaccessible due to its protection level.</p>
    
    <p>Source Error:  </p>
  </blockquote>
  
  <pre><code>Line 1:  @Code 
  Line 2:      ViewData("Title") = "Index" 
  Line 3:  End Code 
  </code></pre>
  
  <p>The Views web.config appears to be correct as it contains the various required namespace:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
        &lt;section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
  
    &lt;system.web.webPages.razor&gt;
      &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt;
        &lt;namespaces&gt;
          &lt;add namespace="System.Web.Mvc" /&gt;
          &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
          &lt;add namespace="System.Web.Mvc.Html" /&gt;
          &lt;add namespace="System.Web.Routing" /&gt;
          &lt;add namespace="MVCAjaxWorkbench" /&gt;
        &lt;/namespaces&gt;
      &lt;/pages&gt;
    &lt;/system.web.webPages.razor&gt;
  
    &lt;appSettings&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
    &lt;/appSettings&gt;
  
    &lt;system.webServer&gt;
      &lt;handlers&gt;
        &lt;remove name="BlockViewHandler"/&gt;
        &lt;add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /&gt;
      &lt;/handlers&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>and the main web.config appears to be correct as well:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=301880
    --&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;add key="webpages:Version" value="3.0.0.0"/&gt;
      &lt;add key="webpages:Enabled" value="false"/&gt;
      &lt;add key="ClientValidationEnabled" value="true"/&gt;
      &lt;add key="UnobtrusiveJavaScriptEnabled" value="true"/&gt;
    &lt;/appSettings&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.5.1"/&gt;
      &lt;httpRuntime targetFramework="4.5.1"/&gt;
    &lt;/system.web&gt;
    &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0"/&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0"/&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I think that something has gone wrong with my installation of IISExpress. I've reviewed the options for using <a href="http://msdn.microsoft.com/en-us/library/58wxa9w5.aspx" rel="nofollow">IIS instead of IISExpress</a> and I really would much prefer to stick with IISExpress but simply reinstalling it has made no difference. My next step is to try reinstalling Visual Studio but I'd rather avoid that if possible as it tends to have side effects of its own.</p>
  
  <p>How can I repair my IISExpress installation so that it functions correctly with Visual Studio?</p>