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

S

SeanGallavan

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
application.
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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top