Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3677188
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:11:28+00:00 2026-05-19T03:11:28+00:00

we have implemented C# web service and deployed in IIS 6.0 server As per

  • 0

we have implemented C# web service and deployed in IIS 6.0 server

As per the requirement I need to create a session and hold the same session indefinitely on the application domain until we restart the service.

to implement this I have created a static member variable in the class to hold the session and creating the session on first invocation. This means that the session will be held across all instances in the application scope. The following is the code snippet

public Class MyClass{

 private static ESession session = null;

 public void testMethod(string configlocation){

  if (session == null)
  {
   ISessionConfigurer sessionConfigurer = new ESessionConfigurer();
   sessionConfigurer.ConfigLocation = configLocation;

   session = sessionConfigurer.CreateSession() as ESession;
  }
 }
}

Here I can’t instantiate the session object on the declaration itself as it requires parameter ‘configLocation’ to be passed from other class.

what I observed was that the session object is available for multiple invocations across all instances but after after 30 minutes of idle time the session object is setting to null again.

My initial thought was that this is happening due to the IIS server recycling the objects. Is it correct? if yes how to prevent recycling the objects forever? what configuration parameters I need to set on the IIS server 6.0 application pool

Is there any implications if we set application pool not to recycle like memory issues etc. or is there any better way to implement my requirement.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:11:28+00:00Added an answer on May 19, 2026 at 3:11 am

    “hold the same session indefinitely” is not the correct solution to this problem, neither is fiddling with IIS to prevent the AppDomain from unloading.

    A better, long term solution which doesn’t require any funky configuration is to persist your session to a file, or database, or somewhere else before the application terminates. When the application starts back up, you can reconstruct your persisted session (if it exists), or create a new one.

    Easiest way to approach this is to make use of the global.asax file at the root of your application (if it doesn’t exist, Visual Studio can create one for you, or you can find plenty of samples online to create it yourself), then override the following methods:

    void Application_Start(object sender, EventArgs e)
    {
        // initialize your session
    }
    
    void Application_End(object sender, EventArgs e)
    {
        // persist your session
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have deployed ASP.NET web site and ASP.NET web service on the same web
I have implemented a generic handler to work as a restful web service in
I have a .NET 3.5 web application for which I have implemented a class
Background: I have a WCF service deployed on my local machine that in turns
I have a timer job which has been deployed to a server with multiple
I have a web app, that consumes a web service. The main page runs
I have implement a small web service using .net 3.5. I have used linq
I have to implement a web service, which takes a Microsoft PowerPoint presentation as
My requirement is to call WCF web service from ASP.NET code behind and pass
I have created a program in visual c++, where i have implemented a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.