title: Web Service Singleton object problem
body: <p>I am creating a singleton object in the first request to the web service and keeping it in the memory. </p>
  
  <p>This works fine for first few seconds. If I make a request 5 minutes later, I can see that the singleton object is created again? is my singleton object getting disposed after x no of minutes ? </p>
  
  <p>how can i make increase the life-time of my object forever ?</p>
  
  <pre><code>    public sealed class Singleton
      {
          static ServerInstance instance = null;
          static readonly object padlock = new object();
  
          Singleton() {
          }
  
          public static ServerInstance Instance {
              get {
                  lock (padlock) {
                      if (instance == null) {
                          instance = new ServerInstance();
                      }
                      return instance;
                  }
              }
          }
          ~Singleton()
          {
            #if DEBUG
                    ExceptionFactory.Fatal("~Singleton() called!");
            #endif
          }
      }
  
  
      [WebMethod]
      public string OnReceiveEvent(string objectXmlData, string objectType) {
  
          if (!Singleton.Instance.initServerComplete) {
              InitServer();
          }
  
         return Singleton.Instance.OnReceiveEvent(objectXmlData, objectType);
      }
  
  
   public void InitServer() {
              if (!Singleton.Instance.initServerComplete) {
                  Singleton.Instance.InitServer();
                  Singleton.Instance.initServerComplete = true;
  
                  GC.KeepAlive(Singleton.Instance);
              }
          }
  </code></pre>