By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,723 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,723 IT Pros & Developers. It's quick & easy.

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

P: n/a
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!

Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.