title: "An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page..."
body: <p>I'm trying to publish an MVC website as an Azure webrole.</p>
  
  <p>When I run it locally, everything works fine. </p>
  
  <p>But once I publish it to Azure and surf to some MVC action, I get this error:</p>
  
  <blockquote>
    <p><strong>Server Error in '/' Application.</strong></p>
    
    <p><strong>Runtime Error</strong></p>
    
    <p><strong>Description: An exception occurred while processing your request.
    Additionally, another exception occurred while executing the custom
    error page for the first exception. The request has been terminated.</strong></p>
  </blockquote>
  
  <p>I don't understand how the error handler can encounter an exception, because errors are handled in the default way:</p>
  
  <pre><code>public class FilterConfig
  {
      public static void RegisterGlobalFilters(GlobalFilterCollection filters)
      {
          filters.Add(new HandleErrorAttribute());
      }
  }
  </code></pre>
  
  <p>This is my web.config:</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=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.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=2.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=4.0.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;/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.web&gt;
          &lt;httpHandlers&gt;
        &lt;add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/&gt;
      &lt;/httpHandlers&gt;
  
      &lt;pages
          validateRequest="false"
          pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
          pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
          userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;controls&gt;
          &lt;add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /&gt;
        &lt;/controls&gt;
      &lt;/pages&gt;
    &lt;/system.web&gt;
  
    &lt;system.webServer&gt;
      &lt;validation validateIntegratedModeConfiguration="false" /&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>This is Error.cshtml:</p>
  
  <pre><code>@model System.Web.Mvc.HandleErrorInfo
  
  @{
      ViewBag.Title = "Error";
  }
  
  &lt;h2&gt;
      Sorry, an error occurred while processing your request.
  &lt;/h2&gt;
  </code></pre>
  
  <p>What can cause this exception, and why can't I reproduce it locally?</p>