Using ServiceStack with Razor MVC. I configured a few custom error pages and a fallback error page in my AppHostBase.Configure
override like this:
this.CustomErrorHttpHandlers[HttpStatusCode.MethodNotAllowed] = new RazorHandler("/views/error/comingSoon");
this.CustomErrorHttpHandlers[HttpStatusCode.NotFound] = new RazorHandler("/views/error/notFound");
this.GlobalHtmlErrorHttpHandler = new RazorHandler("/views/error/general");
Each error view inherits from ViewPage
but is not disposed when the request ends.