The OwinFramework.ExceptionReporter Project
This middleware adds the following behaviour to your website:
- Wraps the downstream OWIN pipeline in a try/catch block.
When exceptions are caught, if they are of type HttpException then
the Http status code and message from the exception are send back to
the client as a valid http response.
For other kinds of execptions the middleware returns either a public
apology page or detailed technical information. The public apology
page is templated and the default template allows a message to be
inserted. For many applications you will want to change the template
to match the design of the rest of your site.
Optionally sends email with detailed technical information about
the exception that occured.
Adding this middleware to the Owin pipeline
The assumes that you are using Ninject as your IoC container, and followed the
getting started walkthrough
. If this is not the case
then you will need to adjust the code to work in your application.
The configuration below is the configuration you will get by default if you do not provide
a configuration for this middleware.
"emailSubject": "Unhandled exception in web site"
To send emails when unhandled exceptions are caught, configure a valid
email address and configure the standard .Net email sender with SMTP details.
When "localHost" is set to "true", requests originating from the web server
machine always result in detailed technical information.
To return detailed technical information only to centain users, install
Identification and Authorization middleware then configure the "requiredPermission"
to the code name of a permission that you configured in authorization.
To define the public apology message set the "message" property to a string.
To completely replace the public message with a page of your own design set the
"template" property to the path of your template file.