Last post Jan 12, 2012 10:03 AM by atconway
Jan 12, 2012 04:40 AM|Spider.net|LINK
I we created a Enterprice library application which contain DAL layer, business layer hosted in IIS as WCF service. Presentation layer (ASP.NET) is
hosted seperatly. The WCF reference is created in ASP.NET, using web reference, we are do database operations.
Now iam requested to implement Exception handling in both WCF service as well in ASP.NET application. Can any one suggest me, What is the
best way to implement Exception handling in both sides.
Jan 12, 2012 08:18 AM|b471code3|LINK
Don't know that I can speak for the WCF project but for the ASP.NET application you can add a global.asax file and inside the Application_Error event you can capture all your errors without doing anything else to your application. This works well for a
"global" error handler and you can redirect people to an Error page without showing them any kind of the default asp.net error code. I've worked on applications that in that Application_Error event they write a log file to a database, write a log file to
the System Event logs on the server the application is running on, send emails to people, or just do nothing but capture the event and redirect someone.
Jan 12, 2012 10:03 AM|atconway|LINK
Read the following which should describe what you need:
"The Enterprise Library Exception Handling Application Block helps developers and policy makers implement common design patterns and
create a consistent strategy for processing exceptions that occur in all architectural layers of an enterprise application. It is designed to support the typical code contained in catch statements in application components. Instead of repeating
this code (such as code that logs exception information) in identical catch blocks throughout an application, the Exception Handling Application Block allows developers to encapsulate this logic as reusable exception handlers."
The above is describing the use of The Exception Handling Block which is part of the Microsoft Enterprise Library. I would recommend this approach for consistient exception handling in your different layers:
The Exception Handling Application Block: