Network Load Balancing & Application_Start() not firing & Session clues

Discussion in 'ASP .Net' started by SeanGallavan, Mar 1, 2005.

  1. SeanGallavan

    SeanGallavan Guest

    Our Environment:

    Two network load balanced (using Microsoft NLB software) webservers
    with session maintained in a SQL Server database. NLB is configured
    with no affinity settings and two network cards in each machine.
    Machine keys are identical on both webservers. There is no anti-virus
    software installed. SQL Server database is storing session information
    as specified by Microsoft guidelines.

    Steps to reproduce the problem:

    1. Add HttpContext.Current.Trace.Write() calls to Application_Start()
    in global.asax.cs and enclose everything in try/catch blocks which log
    errors to a separate database (error writing was tested in
    Application_Start() separately and proven to work). Add counter to
    Appliction_BeginRequest() which writes to Trace.Write the number of
    requests served by the application thread (as stored in
    Application["counter"])...proving that the application has restarted
    and that we are viewing the inital request. Add call to Trace.Write()
    to show which machine in the cluster is serving the request.
    2. Edit web.config on each webserver to force them to reload the
    3. Access cluster address - Application_Start() is called correctly.
    4. Continue to hit cluster address until our request is shifted to the
    other webserver - Application_Start() does not fire.

    Our Analysis:

    By adding host headers specific to each webserver, we have been able to
    prove that either server is able to correctly load Application_Start()
    when it is the first server to serve the request. If we manually hit
    each server individually, then the object will be loaded in
    Application_Start() and subsequent transfers between server will occur
    without error (the object is not lost from the Application[] object).

    The only time we experience an error is when the request is transferred
    from one server to the other and the server to which it has been
    transferred needs to launch the application for the first time. When
    this happens, Application_Start() does not fire and no error is
    generated. The trace that would usually appear on Application_Start()
    never appears and the object is never stored in Application[].

    Additional Symptomology:

    We have noticed some interesting session behavior in our environment.
    Our current hypothesis is that it is occurring under the same
    conditions as the Application_Start() problem (namely, transferring to
    a server not already running our app). When a user is authenticated to
    our application, we read a number of items from a configuration table
    (including their stylesheet) and store them in the session object which
    is held on the SqlServer. When the problem happens, the user remains
    logged into the application but the stylesheet is lost. This seems to
    indicate that the session is not completely lost, but the information
    is not read properly out of the database. The only way to fix this is
    to logout of the application and login again to create a new session.

    Any help with this problem would be most appreciated. We are all
    experienced programmers and explanations of InProc sessions or how to
    use a database will probably not be very helpful.

    Thank you in advance!
    SeanGallavan, Mar 1, 2005
    1. Advertisements

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. Robert

    Session state with load balancing

    Robert, Feb 26, 2004, in forum: ASP .Net
    Jan 30, 2009
  2. SMG
    Brock Allen
    Mar 24, 2005
  3. Andrew Robinson

    Session ID and Cluster / Network Load Balancing

    Andrew Robinson, Jun 21, 2005, in forum: ASP .Net
    WenJun Zhang[msft]
    Jun 22, 2005
  4. =?Utf-8?B?WW9hdg==?=

    Session state and load balancing - 2.0

    =?Utf-8?B?WW9hdg==?=, May 6, 2007, in forum: ASP .Net
    May 7, 2007
  5. Replies:

Share This Page