Using Exception Management Application Block in a Web App

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QnJldHQgT3NzbWFu?=

    #1

    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_Except ion_Processing. Vb in the app's Component folder with the
    ExceptionManage r.Publish(ex) call.

    Here is the code generating the error:
    ExceptionManage r.VB (straight from the sample app):
    Private Shared Function Activate(ByVal [assembly] As String, ByVal typeName
    As String) As Object
    Return AppDomain.Curre ntDomain.
    CreateInstanceA ndUnwrap([assembly], typeName)
    End Function

    and the error:
    "Could not load type IntranetPlus.Ex ceptionPublishe r from assembly
    intranetplus, Version=1.0.263 8.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.Appli cationBlocks.Ex ceptionManageme nt
    b) Microsoft.Appli cationBlocks.Ex ceptionManageme nt.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.Appli cationBlocks.Ex ceptionManageme nt.dll
    ii) Microsoft.Appli cationBlocks.Ex ceptionManageme nt.Interfaces.d ll
    c) Removed all "Imports Microsoft.Appli cationBlocks.Ex ceptionManageme nt"
    and
    "Imports intranetplus.In tranet_Exceptio n_Processing" from individual
    source
    files and added "intranetplus.I ntranet_Excepti on_Processing" (our
    handler -
    see above) to the project Imports setting.
    3) Our App's Components Folder
    a) Added the sample app's ExceptionPublis her.vb to folder and our main
    project
    4) Our Intranet_Except ion_Processing. vb error handler
    a) Included "Imports Microsoft.Appli cationBlocks.Ex ceptionManageme nt".
    5) Our Web.Config
    a) Added configSections section for ExceptionManage ment
    <configSections >
    <section name="exception Management"
    type="Microsoft .ApplicationBlo cks.ExceptionMa nagement.Except ionManagerSecti onHandler,Micro soft.Applicatio nBlocks.Excepti onManagement" />
    </configSections>
    b) Added exceptionManage ment section
    <exceptionManag ement>
    <publisher mode="on" assembly="Intra netPlus"
    type="IntranetP lus.ExceptionPu blisher"
    fileName="c:\Er ror.log"
    operatorMail="a bc123@company.c om" />
    </exceptionManage ment>
  • sloan

    #2
    Re: Using Exception Management Application Block in a Web App

    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:




    <exceptionManag ement mode="on">

    <publisher assembly="Compa nyName.Exceptio ns"
    type="CompanyNa me.Exceptions.C ustomPublisherL ib.ExceptionBas eCustomPublishe r
    "
    exceptionFormat ="xml" />

    </exceptionManage ment>


    where
    CompanyName.Exc eptions.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:\Er ror.log"
    operatorMail="a bc123@company.c om" />
    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" <BrettOssman@di scussions.micro soft.comwrote in message
    news:06518AA0-A426-445F-A141-852178F13D55@mi crosoft.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_Except ion_Processing. Vb in the app's Component folder with the
    ExceptionManage r.Publish(ex) call.
    >
    Here is the code generating the error:
    ExceptionManage r.VB (straight from the sample app):
    Private Shared Function Activate(ByVal [assembly] As String, ByVal
    typeName
    As String) As Object
    Return AppDomain.Curre ntDomain.
    CreateInstanceA ndUnwrap([assembly], typeName)
    End Function
    >
    and the error:
    "Could not load type IntranetPlus.Ex ceptionPublishe r from assembly
    intranetplus, Version=1.0.263 8.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.Appli cationBlocks.Ex ceptionManageme nt
    b) Microsoft.Appli cationBlocks.Ex ceptionManageme nt.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.Appli cationBlocks.Ex ceptionManageme nt.dll
    ii) Microsoft.Appli cationBlocks.Ex ceptionManageme nt.Interfaces.d ll
    c) Removed all "Imports
    Microsoft.Appli cationBlocks.Ex ceptionManageme nt"
    and
    "Imports intranetplus.In tranet_Exceptio n_Processing" from
    individual
    source
    files and added "intranetplus.I ntranet_Excepti on_Processing" (our
    handler -
    see above) to the project Imports setting.
    3) Our App's Components Folder
    a) Added the sample app's ExceptionPublis her.vb to folder and our main
    project
    4) Our Intranet_Except ion_Processing. vb error handler
    a) Included "Imports Microsoft.Appli cationBlocks.Ex ceptionManageme nt".
    5) Our Web.Config
    a) Added configSections section for ExceptionManage ment
    <configSections >
    <section name="exception Management"
    >
    type="Microsoft .ApplicationBlo cks.ExceptionMa nagement.Except ionManagerSecti o
    nHandler,Micros oft.Application Blocks.Exceptio nManagement" />
    </configSections>
    b) Added exceptionManage ment section
    <exceptionManag ement>
    <publisher mode="on" assembly="Intra netPlus"
    type="IntranetP lus.ExceptionPu blisher"
    fileName="c:\Er ror.log"
    operatorMail="a bc123@company.c om" />
    </exceptionManage ment>

    Comment

    Working...