title: How to access the Application[] collection from a WCF web service
body: <p>I used to use .ASMX web services, but I'm trying to move to WCF because it's the latest newest thing, and it's supposed to be better.</p>
  
  <p>Anyway, what I'm wanting to do is really really simple : create a webservice that empties the Application collection by calling Application.Clear().  In an ASMX web service, this is really really simple, because .ASMX webservices have full access to the Application[] collection.  However, this doesn't really work in WCF.</p>
  
  <p>So, here's my service contract :</p>
  
  <pre><code>[ServiceContract]
  public interface IFlusherServicePage
  {
      [OperationContract]
      void FlushApplicationCache();
  }
  </code></pre>
  
  <p>Here's my implementing class :</p>
  
  <pre><code>public class FlusherServicePage : Page, IFlusherServicePage
  {
      public void FlushApplicationCache()
      {
          Application.Clear();
      }
  }
  </code></pre>
  
  <p>And here's my .svc file :</p>
  
  <pre><code>&lt;%@ ServiceHost Language="C#" Debug="true" Service="FlusherServicePage" CodeBehind="~/App_Code/FlusherServicePage.cs" %&gt;
  </code></pre>
  
  <p>Everything compiles fine.  However, when I call my webservice, FlushApplicationCache() throws a NullReferenceException, because Application[] is null.</p>
  
  <p>Is there any way to access the Application[] collection from a WCF webservice?  Or do I need to go back to .ASMX?</p>