Unable to connect to SQL Server session database

Discussion in 'ASP .Net' started by jamezw, Jun 16, 2005.

  1. jamezw

    jamezw Guest


    I work on a website where we have 3 servers running one site so we use
    the SQLServer option for state management. We are using the persistent
    ASPState database. All 3 of our webservers are Win2K3 and up-to-date.
    Our SQL Server is up-to-date as well. We have been getting weird
    site-hanging issues lately which seem to be related to the state
    management. Whenever the site starts hanging we will receive an
    application error with a stacktrace like such:

    System.Web.HttpException: Unable to connect to SQL Server session
    database. ---> System.Data.SqlClient.SqlException: Timeout expired.
    The timeout period elapsed prior to completion of the operation or the
    server is not responding.
    at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
    cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
    at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
    id, Int32 lockCookie)
    --- End of inner exception stack trace ---
    id, Int32 lockCookie)
    id, Int32 lockCookie)
    at System.Web.SessionState.SessionStateModule.OnReleaseState(Object
    source, EventArgs eventArgs)
    at System.Web.SessionState.SessionStateModule.OnEndRequest(Object
    source, EventArgs eventArgs)
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
    Boolean& completedSynchronously)

    When these errors occur, they occur on all three webservers at the same
    time, and the same error will re-occur almost exactly 10 minutes later.
    We don't have any jobs running on the SQL server or the web servers
    that occur every 10 minutes, so we have ruled that out. To fix this
    problem, usually we recycle the aspnet processes, but sometimes this
    does not work and we have to stop/start SQL Server. In the worst case
    scenario, we end up rebooting our SQL Server to "fix" the problem. This
    is a really problematic issue for us because it seems to happen during
    high traffic times. Has anyone else experienced something similar to
    this or know of an MS fix?

    jamezw, Jun 16, 2005
    1. Advertisements

  2. jamezw

    Guest Guest

    Did you set your SqlCommand timeout? That defaults to 30 seconds.
    Please try to set CommandTimeout to 180 or longer time:
    YourCommand.CommandTimeout = 180
    Guest, Jun 17, 2005
    1. Advertisements

  3. jamezw

    jamezw Guest

    It's not as simple as that. The problem is with .NET's session
    management through SQL server.
    jamezw, Jun 17, 2005
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.