locked
HttpApplication life span RRS feed

  • Question

  • User-835257779 posted

    Recently I have been looking into creating 'services' running in my asp.net application. These services will be called by helpers, but will persist so that they maintain performance by having 'indexes' of the items added to them rather than calling up a database or xml file whenever items within it are examined.

    I decided to inherit a httpmodule to run the service, the service would be initiailized by the applications initialization, at which time the service would load in the xml file/database table and thus contain the most current index.

    I am however wondering if this approach is the best- the httpmodule appears to persist the lifetime of the application which is what i require, but am i using the right class to represent a 'service'.

     Also, my helper class looks through the application's modules to find the 'service' and call methods to it -- is this the right approach too?

     The service basically acts as a 'redirector' that allows me to subscribe paths and where they should actually end up, the service maintains token folder structures so that isapi will forward requests to .net (i cant tell iis to forward them because this is a shared server).

     
    Hopefully that makes sense, and I am aware that creating empty folders with token default.aspx files isn't the best idea, but its the only way i can actually acheive a 'restful' path structure within our site.

    Wednesday, November 15, 2006 8:32 AM

Answers

  • User300685930 posted
    I think I get it.  I would agree that the HttpModule would be the right way to go.  If I understand correctly, the other way would be to make it an httphandler (ashx file) and use Cache.  You would of course check the Cache to make sure it is not null and reload it if it is.  The advantage to this is you don't need to modify your global.asax file.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 15, 2006 11:10 AM

All replies

  • User300685930 posted
    HttpApplication does not survive server restarts (which do happen periodically).  If you really want to persist the data you should store it to a database or something truly persistent. (like a file if you are on a single server environment).
    Wednesday, November 15, 2006 10:16 AM
  • User-835257779 posted

    Sorry Peter I probably didnt explain well.

    The service will save the data to an XML file, but as well as this it will store the 'brief' information in memory for quicker indexing of this saved data. This way an application end won't actually cause data loss because the data is actually persisted in full in the xml file. So when the application starts the httpmodule should be initialized, and during init() it checks the web.config for the configuration data, then during the first request it will map to the XML file and retreive the 'brief' information from it and store it in memory for indexing.

    I'm not entirely sure if this indexing is useful, it saves me time opening an xml document and iterating over the data to find a match, but may be more fuss this way than its worth.

    I guess my base question was- are modules the 'way to go' when trying to run 'services' on an asp.net application.
     

    Wednesday, November 15, 2006 11:00 AM
  • User300685930 posted
    I think I get it.  I would agree that the HttpModule would be the right way to go.  If I understand correctly, the other way would be to make it an httphandler (ashx file) and use Cache.  You would of course check the Cache to make sure it is not null and reload it if it is.  The advantage to this is you don't need to modify your global.asax file.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 15, 2006 11:10 AM