471,873 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

Using Exception Management Application Block in a Web App

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.In terfaces
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.dl l
ii) Microsoft.ApplicationBlocks.ExceptionManagement.In terfaces.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.ExceptionManagem ent.ExceptionManagerSectionHandler,Microsoft.Appli cationBlocks.ExceptionManagement" />
</configSections>
b) Added exceptionManagement section
<exceptionManagement>
<publisher mode="on" assembly="IntranetPlus"
type="IntranetPlus.ExceptionPublisher"
fileName="c:\Error.log"
operatorMail="ab****@company.com" />
</exceptionManagement>
Mar 23 '07 #1
1 2307
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.Ex ceptionBaseCustomPublisher
"
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="ab****@company.com" />
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/de...onhandlers.asp )
' also see
http://support.microsoft.com/default...b;en-us;309045 // Article
ID : 309045

"Brett Ossman" <Br*********@discussions.microsoft.comwrote in message
news:06**********************************@microsof t.com...
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.In terfaces
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.dl l
ii) Microsoft.ApplicationBlocks.ExceptionManagement.In terfaces.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.ExceptionManagem ent.ExceptionManagerSectio
nHandler,Microsoft.ApplicationBlocks.ExceptionMana gement" />
</configSections>
b) Added exceptionManagement section
<exceptionManagement>
<publisher mode="on" assembly="IntranetPlus"
type="IntranetPlus.ExceptionPublisher"
fileName="c:\Error.log"
operatorMail="ab****@company.com" />
</exceptionManagement>

Mar 23 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Abelardo Vacca | last post: by
2 posts views Thread by kendf | last post: by
2 posts views Thread by alexandre jenny | last post: by
reply views Thread by Florida . NET Coder | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.