Session State lost in asp.net - solution explained.

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Session State lost in asp.net - solution explained.

    Hello,

    I just thought I'd share my particular situation regarding session
    state periodically being "lost" in my asp.net app. I read with
    interest all of the posts regarding lost session state (virus scanner,
    modified assemblies/configs, etc.). The suggested solution of using a
    'State Server' or 'SQL State Server' was not attractive to me given
    the drawbacks: performance, objects must be serializable, no more
    Session_End.

    Perhaps the most helpful advice I ran across was to use Performance
    Monitor (perfmon) to monitor various counters of the .NET processes.
    So, I setup perfmon and added all sorts of counters. The two counters
    that led to my solution were: Application Restarts and Compilations
    Total. After a period of monitoring I noticed that 'Compilations
    Total' would hit a threshold and kick off an Application Restart
    (which in turn caused anyone in my app to lose their session state).
    After careful review of the machine.config file, I found the culprit:

    numRecompilesBeforeAppRestart="max number of recompilations before
    appdomain is cycled" // Default: 15 recomplations

    If I increase this number to say "9999", I never run into the lost
    session state. However, I am concerned about this solution given by
    the fact that the default value is so low (15 - why????). Unless
    someone can point out the reason this may be a bad fix, I will happily
    continue forward (my users are happy now too).

    Brian Schloz
    Lead Software Engineer
    JHOB Technologies, LLC
    Brian Schloz Guest

  2. Similar Questions and Discussions

    1. <<<Ability to deliver professional and state of the art web solution Online>>>
      <<<Ability to deliver professional and state of the art web solution Online>>> WickedInnovations has an extensive working experience in...
    2. Session state IIS (Machine Key | Load Balanced Session)
      This is a classic ASP group. Try microsoft.public.dotnet.framework.aspnet "Fred" <me@me.com> wrote in message...
    3. Dynamic control state changes lost on Postback
      I have been developing a set of custom controls that include several dynamically generated controls inside them (for example, 'SupportTextBox'...
    4. Sessions State Lost in CFMX and WebLogic - HELP
      We are currently using ColdFusion 6.1 with WebLogic 8.1 and are having problems with the session replication and/or server failover. I decided to...
    5. Lost 'Save to Web' - possible solution for Max OS X users
      Well that sneaky software! It creates a separate Preference folder for that feature, huh? That's good to know. I don't remember poking around as much...
  3. #2

    Default Re: Session State lost in asp.net - solution explained.

    The downside is you have to manually restart the app every once in awhile to
    clear out memory. There is a known bug in 1.0 (see KB 319947).

    In most cases, you should not have to dynamically recompile resources very
    often. If your app recompiles on a regular basis, you have another problem:
    perhaps a design problem, perhaps a resource problem.

    One possibility, for example, is an app that writes values to web.config,
    which will force a dynamic recompile. If this case, the correct design would
    be to only store constants in the .config and other app values in either a
    static object or some other form of cache.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    Author: ADO.NET and XML: ASP.NET on the Edge

    ************************************************** **************************
    ****
    Think Outside the Box!
    ************************************************** **************************
    ****
    "Brian Schloz" <bschloz@hotmail.com> wrote in message
    news:e35f6178.0307250702.6f6450dd@posting.google.c om...
    > Hello,
    >
    > I just thought I'd share my particular situation regarding session
    > state periodically being "lost" in my asp.net app. I read with
    > interest all of the posts regarding lost session state (virus scanner,
    > modified assemblies/configs, etc.). The suggested solution of using a
    > 'State Server' or 'SQL State Server' was not attractive to me given
    > the drawbacks: performance, objects must be serializable, no more
    > Session_End.
    >
    > Perhaps the most helpful advice I ran across was to use Performance
    > Monitor (perfmon) to monitor various counters of the .NET processes.
    > So, I setup perfmon and added all sorts of counters. The two counters
    > that led to my solution were: Application Restarts and Compilations
    > Total. After a period of monitoring I noticed that 'Compilations
    > Total' would hit a threshold and kick off an Application Restart
    > (which in turn caused anyone in my app to lose their session state).
    > After careful review of the machine.config file, I found the culprit:
    >
    > numRecompilesBeforeAppRestart="max number of recompilations before
    > appdomain is cycled" // Default: 15 recomplations
    >
    > If I increase this number to say "9999", I never run into the lost
    > session state. However, I am concerned about this solution given by
    > the fact that the default value is so low (15 - why????). Unless
    > someone can point out the reason this may be a bad fix, I will happily
    > continue forward (my users are happy now too).
    >
    > Brian Schloz
    > Lead Software Engineer
    > JHOB Technologies, LLC

    Cowboy \(Gregory A. Beamer\) Guest

  4. #3

    Default Re: Session State lost in asp.net - solution explained.

    Update. I solved the second issue (Application Restart for no apparent
    reason). It was the network backup. Evidently, SMB does *something*
    with the file to cause the 'Accessed' bit to be updated and therefore a
    NET application restart when the web.config and/or bin directories are
    subjected to the backup process (note: the Archive bit remained
    unchanged). I only noticed it when I turned on the Accessed column in
    Explorer (right click on the heading and add 'Accessed' column). Since
    it was happening when nobody was on the system (at night) I assumed it
    was because the process was idle. Anyhow, I think slowly but surely I'm
    getting there.

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Brian Schloz Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139