title: Who is invoking Error view and why?
body: <p>I got a MVC4 web application running and functioning properly since almost a year. Lately while reviewing production error logs, I found a lot of mysterious exception entries of same type. I checked logs and found these exceptions occur on both Beta and Production environment but not in local (seems like a hint - see findings 1 below).</p>
  
  <p>There are two subsequent entries:</p>
  
  <p>One is:</p>
  
  <blockquote>
    <p>Thread Id: 56, Message: Server_Exception - The view 'Error' or its
    master was not found or no view engine supports the searched
    locations. The following locations were searched:
    ~/Views/OrganizationUser/Error.cshtml
    ~/Views/OrganizationUser/Error.vbhtml ~/Views/Shared/Error.cshtml
    ~/Views/Shared/Error.vbhtml</p>
  </blockquote>
  
  <p>Second log entry is:</p>
  
  <blockquote>
    <p>Thread Id: 56, Message: Server_Exception - Stack Trace -    at
    System.Web.Mvc.ViewResult.FindView(ControllerContext context)    at
    System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
    at
    System.Web.Mvc.Async.AsyncControllerActionInvoker.&lt;>c__DisplayClass25.b__22(IAsyncResult
    asyncResult)    at
    System.Web.Mvc.Controller.&lt;>c__DisplayClass1d.b__18(IAsyncResult
    asyncResult)    at
    System.Web.Mvc.Async.AsyncResultWrapper.&lt;>c__DisplayClass4.b__3(IAsyncResult
    ar)    at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult
    asyncResult)    at
    System.Web.Mvc.Async.AsyncResultWrapper.&lt;>c__DisplayClass4.b__3(IAsyncResult
    ar)    at
    System.Web.Mvc.MvcHandler.&lt;>c__DisplayClass8.b__3(IAsyncResult
    asyncResult)    at
    System.Web.Mvc.Async.AsyncResultWrapper.&lt;>c__DisplayClass4.b__3(IAsyncResult
    ar)    at
    System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    Boolean&amp; completedSynchronously)</p>
  </blockquote>
  
  <p>The exception is logged from Application_Error() in global.asax.cs like so:</p>
  
  <pre><code>            var ex = Server.GetLastError();
  
              if (ex != null)
              {
                  logger.Log(string.Format("Server_Exception - {0}", ex.Message), LogCategory.Error);
                  logger.Log(string.Format("Server_Exception - Stack Trace - {0}", ex.StackTrace), LogCategory.Error);
              }
  </code></pre>
  
  <p>And here is the snapshot of DB log messages:</p>
  
  <p><img src="https://i.stack.imgur.com/G5UgF.jpg" alt="enter image description here"></p>
  
  <p><strong>Finding/Analysis</strong>:</p>
  
  <ol>
  <li><p>Since the errors are logged only on remote server, it tells me it has got to do with how MVC handles remote errors? CustomErrors? - I don't have it defined it in web.config. Should I?</p></li>
  <li><p>But the main question is, what caused the error to happen? And who is looking for view name Error? I know its hard for you to guess it but just checking my luck.</p></li>
  <li><p>Another finding is the exceptions are logged after user has logged out. In my Login get form, I check isAuthenticated and if user is not authenticated I log a message 'Request not authenticated, showing login form.' and display login form. I can see this message in logged prior to above exception messages. So what's going on on login.cshtml that causes a contact to server which generates an error? I checked, login page and _Layout which has lots of server side code embedded but could not figure out what could cause server to try to load Error page.</p></li>
  </ol>
  
  <p>I think internally MVC is calling Error page which does not exist in my source code hence these exception. But why 'Error' page? I thought to get advice on what to check in this case. Please advise if you want me to share anything that could help you understand my problem.</p>