asp.netiis-7web-gardensession-state-server

Asp.net 2.0 Button click method works inconsistently in a web garden


We have a asp.net 2.0 web application that is running on IIS7. It is using web gardens and asp.net state server.

On the page, there are many user controls. On one of the user controls, we have added logging on the button_click event that writes a line in the log whenever that method runs. When we click the button, it only periodically displays the log entry – indicating that the event does not always fire when the button is clicked. We added the logging because we suspected that the button click method was not always running when we clicked the button. The evidence we are seeing seems to confirm our suspicions.

When we remove the web garden and put the site back to a single application pool, the application returns to normal - the button event fires every time. When we run the application on local developer machines, it also works normally.

Has anyone else seen behavior like this? Are there any recommendations on next steps we could take to narrow down the problem?

EDIT: here is the source of the event as requested:

protected void btnSearch_Click(object sender, EventArgs e)
    {
        Log.Error("Searching...");

        SearchArgs args = CtrlToSearchArgs();
        SessionManager.SearchQueryString = Request.QueryString;

        string url = NavigationManager.BuildSearchUrl(args, null, "*** page url removed here ***");

        if (args.PageSize.HasValue)
        {
            SessionManager.SetInSession(SessionManager.Key.SEARCH_PAGESIZE, args.PageSize.Value.ToString());
        }
        else
        {
            SessionManager.SetInSession(SessionManager.Key.SEARCH_PAGESIZE, "10");
        }

        SessionManager.SearchPanelData = url;

        //Set the new args into the session
        SessionManager.SearchControlArgs = args;

        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Redirect(url);
    }

EDIT # 2: Clarification - this set up is not using multiple servers and is not under a load balancer. We are using multiple AppPools on a single server.


Solution

  • Thanks Freddy and Jason for posting answers.

    During our troubleshooting process, we decided to revert back to a single app pool. It seemed like a pretty unorthodox way to structure things anyway. However, that didn't fix the problem either.

    After going around and around and having a few people go over the code, we finally discovered that we had an object stored in session that contained static variables. We fixed that problem and the site started working as expected.