Initializing and terminating a dll in ASP.NET

Discussion in 'ASP .Net' started by Hiren Patel, Feb 1, 2005.

  1. Hiren Patel

    Hiren Patel Guest

    Hi there,

    I have a third party dll that I need to initialize and terminate once
    and only once per application. By application I mean a physical exe and not
    the HTTP application. This is fine when I am creating a windows application
    as I can use the static void main function to do the initialization and
    termination. But my question is where would I do this in an ASP.NET web app.
    I tried the application_start and application_end events. The initialization
    worked fine but the termination causes a memory access violation. If I
    terminate the dll earlier on lets say page unload, everything works fine.
    But this is not feasiable , since I need to keep using the dll till the
    application is running.

    The only workaround I see to this problem is the make a exe that consumes
    this dll and then shell is from the web application.

    Any other Ideas or suggestions???

    Thanks
     
    Hiren Patel, Feb 1, 2005
    #1
    1. Advertising

  2. Hiren Patel

    bruce barker Guest

    if your using 2000 and not 2003 with app pools, there are several asp.net
    applications hosted under the same exe (aspnet_wp.exe). if you access a dll
    in more than 1 app domain, the dll will get loaded again.

    the easiest approach is to write a com wrapper and host it in com+.

    -- bruce (sqlwork.com)


    "Hiren Patel" <> wrote in message
    news:...
    | Hi there,
    |
    | I have a third party dll that I need to initialize and terminate once
    | and only once per application. By application I mean a physical exe and
    not
    | the HTTP application. This is fine when I am creating a windows
    application
    | as I can use the static void main function to do the initialization and
    | termination. But my question is where would I do this in an ASP.NET web
    app.
    | I tried the application_start and application_end events. The
    initialization
    | worked fine but the termination causes a memory access violation. If I
    | terminate the dll earlier on lets say page unload, everything works fine.
    | But this is not feasiable , since I need to keep using the dll till the
    | application is running.
    |
    | The only workaround I see to this problem is the make a exe that consumes
    | this dll and then shell is from the web application.
    |
    | Any other Ideas or suggestions???
    |
    | Thanks
    |
    |
     
    bruce barker, Feb 1, 2005
    #2
    1. Advertising

  3. Hiren Patel

    Hiren Patel Guest

    Thanks for the suggestion. Lets say if I am always going to be on Win2003,
    what are the other options.


    "bruce barker" <> wrote in message
    news:O%...
    > if your using 2000 and not 2003 with app pools, there are several asp.net
    > applications hosted under the same exe (aspnet_wp.exe). if you access a
    > dll
    > in more than 1 app domain, the dll will get loaded again.
    >
    > the easiest approach is to write a com wrapper and host it in com+.
    >
    > -- bruce (sqlwork.com)
    >
    >
    > "Hiren Patel" <> wrote in message
    > news:...
    > | Hi there,
    > |
    > | I have a third party dll that I need to initialize and terminate
    > once
    > | and only once per application. By application I mean a physical exe and
    > not
    > | the HTTP application. This is fine when I am creating a windows
    > application
    > | as I can use the static void main function to do the initialization and
    > | termination. But my question is where would I do this in an ASP.NET web
    > app.
    > | I tried the application_start and application_end events. The
    > initialization
    > | worked fine but the termination causes a memory access violation. If I
    > | terminate the dll earlier on lets say page unload, everything works
    > fine.
    > | But this is not feasiable , since I need to keep using the dll till the
    > | application is running.
    > |
    > | The only workaround I see to this problem is the make a exe that
    > consumes
    > | this dll and then shell is from the web application.
    > |
    > | Any other Ideas or suggestions???
    > |
    > | Thanks
    > |
    > |
    >
    >
     
    Hiren Patel, Feb 1, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anushi
    Replies:
    5
    Views:
    8,807
  2. Charles A. Lackman

    Terminating a thread from the main thread

    Charles A. Lackman, Dec 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    1,553
    Herfried K. Wagner [MVP]
    Dec 9, 2004
  3. geoffbache
    Replies:
    4
    Views:
    329
    geoffbache
    Jun 25, 2008
  4. Lauren the Ravishing

    ASP - Terminating objects in memory

    Lauren the Ravishing, Jul 26, 2006, in forum: ASP General
    Replies:
    8
    Views:
    132
    Anthony Jones
    Jul 31, 2006
  5. H. Simpson
    Replies:
    4
    Views:
    294
    H. Simpson
    Aug 3, 2004
Loading...

Share This Page