I have searched SO up and down and still getting this error. I cannot, for the life of me understand why.
{"The view 'Error' or its master was not found or no view engine supports the searched locations. The following locations were searched:\r\n~/Views/Administrator/Error.aspx\r\n~/Views/Administrator/Error.ascx\r\n~/Views/Shared/Error.aspx\r\n~/Views/Shared/Error.ascx\r\n~/Views/Administrator/Error.cshtml\r\n~/Views/Administrator/Error.vbhtml\r\n~/Views/Shared/Error.cshtml\r\n~/Views/Shared/Error.vbhtml"}
This is caught a custom error logging class:
internal static class _Logger
{
internal static void Log(Exception ex)
{
string logPath = HttpContext.Current.Server.MapPath(@"\Log\" + DateTime.Now.Month + "_" + DateTime.Now.Year + "_log");
File.AppendAllText(logPath,
"Time:" + DateTime.Now + "\n"
+ ex.Message +"\n" + ex.InnerException + "\n" + ex.StackTrace);
}
}
It is being thrown from here:
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
protected void Application_Error()
{
var ex = Server.GetLastError(); //RIGHT HERE CATCHES IT.
_Logger.Log(ex);
}
}
Route Config:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Administrator",
url: "{controller}/{action}",
defaults: new { controller = "Administrator", action = "Index" }
);
routes.MapRoute(
name: "Trials",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Trials", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Error",
url: "{controller}/{action}",
defaults: new { controller = "Error", action = "Index"}
);
}
What am I missing here?
Thanks.
EDIT
I removed the custom Authorization attribute and I am STILL getting this exception thrown. What confuses me is its never hitting the Catch blocks.
EDIT 2
I went back and did a breakpoint at the the app start.
Edited above is where the exception is actually being thrown from.
why though? I explicitly tell it not to.
Where do you explicitly tell it not to? – mjwills