Using Exception Management Application Block in a Web App

G

Guest

I'm trying to set up a custome e-mail publisher for a web app using the
Microsoft Exception Management Application Block for .NET sample app.

Our app already uses the Exception Management Block, but with the default
publishing to the Event Log. We have an error handler
Intranet_Exception_Processing.Vb in the app's Component folder with the
ExceptionManager.Publish(ex) call.

Here is the code generating the error:
ExceptionManager.VB (straight from the sample app):
Private Shared Function Activate(ByVal [assembly] As String, ByVal typeName
As String) As Object
Return AppDomain.CurrentDomain.
CreateInstanceAndUnwrap([assembly], typeName)
End Function

and the error:
"Could not load type IntranetPlus.ExceptionPublisher from assembly
intranetplus, Version=1.0.2638.14505, Culture=neutral,
PublicKeyToken=null." String
(NOTE: I confirmed the class is defintely there using Class View)

Here's how I implemented the cutsom publisher. Notice I did not modify the
sample app much at all:
1) Added the following Exception Management projects from Microsoft to
the our solution:
a) Microsoft.ApplicationBlocks.ExceptionManagement
b) Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces
2) Our App's Main Project
a) Set references to the above new projects
b) Removed the following DLLs from various places and updated the
references to the new Exception Management projects above
i) Microsoft.ApplicationBlocks.ExceptionManagement.dll
ii) Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces.dll
c) Removed all "Imports Microsoft.ApplicationBlocks.ExceptionManagement"
and
"Imports intranetplus.Intranet_Exception_Processing" from individual
source
files and added "intranetplus.Intranet_Exception_Processing" (our
handler -
see above) to the project Imports setting.
3) Our App's Components Folder
a) Added the sample app's ExceptionPublisher.vb to folder and our main
project
4) Our Intranet_Exception_Processing.vb error handler
a) Included "Imports Microsoft.ApplicationBlocks.ExceptionManagement".
5) Our Web.Config
a) Added configSections section for ExceptionManagement
<configSections>
<section name="exceptionManagement"
type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectionHandler,Microsoft.ApplicationBlocks.ExceptionManagement" />
</configSections>
b) Added exceptionManagement section
<exceptionManagement>
<publisher mode="on" assembly="IntranetPlus"
type="IntranetPlus.ExceptionPublisher"
fileName="c:\Error.log"
operatorMail="(e-mail address removed)" />
</exceptionManagement>
 
S

sloan

Yeah, that happens.

The issue is that you can't "Create Event Log Source" or some permission
like that.

Here is my web.config file:




<exceptionManagement mode="on">

<publisher assembly="CompanyName.Exceptions"
type="CompanyName.Exceptions.CustomPublisherLib.ExceptionBaseCustomPublisher
"
exceptionFormat="xml" />

</exceptionManagement>


where
CompanyName.Exceptions.dll is the assembly with the customer publisher.


I'd recommend putting the custom publisher in its own assembly.


PS

I don't think you can just do this:
fileName="c:\Error.log"
operatorMail="(e-mail address removed)" />

but I might be wrong.

I have these notes in my custom publisher class.

' The section handler interprets and processes the settings defined
in
' XML tags within a specific portion of a Web.config file and
returns an
' appropriate configuration object .... based on the configuration
settings.
' ( above exert from
http://msdn.microsoft.com/library/d...uide/html/cpconcreatingnewsectionhandlers.asp )
' also see
http://support.microsoft.com/default.aspx?scid=kb;en-us;309045 // Article
ID : 309045



Brett Ossman said:
I'm trying to set up a custome e-mail publisher for a web app using the
Microsoft Exception Management Application Block for .NET sample app.

Our app already uses the Exception Management Block, but with the default
publishing to the Event Log. We have an error handler
Intranet_Exception_Processing.Vb in the app's Component folder with the
ExceptionManager.Publish(ex) call.

Here is the code generating the error:
ExceptionManager.VB (straight from the sample app):
Private Shared Function Activate(ByVal [assembly] As String, ByVal typeName
As String) As Object
Return AppDomain.CurrentDomain.
CreateInstanceAndUnwrap([assembly], typeName)
End Function

and the error:
"Could not load type IntranetPlus.ExceptionPublisher from assembly
intranetplus, Version=1.0.2638.14505, Culture=neutral,
PublicKeyToken=null." String
(NOTE: I confirmed the class is defintely there using Class View)

Here's how I implemented the cutsom publisher. Notice I did not modify the
sample app much at all:
1) Added the following Exception Management projects from Microsoft to
the our solution:
a) Microsoft.ApplicationBlocks.ExceptionManagement
b) Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces
2) Our App's Main Project
a) Set references to the above new projects
b) Removed the following DLLs from various places and updated the
references to the new Exception Management projects above
i) Microsoft.ApplicationBlocks.ExceptionManagement.dll
ii) Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces.dll
c) Removed all "Imports Microsoft.ApplicationBlocks.ExceptionManagement"
and
"Imports intranetplus.Intranet_Exception_Processing" from individual
source
files and added "intranetplus.Intranet_Exception_Processing" (our
handler -
see above) to the project Imports setting.
3) Our App's Components Folder
a) Added the sample app's ExceptionPublisher.vb to folder and our main
project
4) Our Intranet_Exception_Processing.vb error handler
a) Included "Imports Microsoft.ApplicationBlocks.ExceptionManagement".
5) Our Web.Config
a) Added configSections section for ExceptionManagement
<configSections>
<section name="exceptionManagement"
type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectio
nHandler,Microsoft.ApplicationBlocks.ExceptionManagement" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top