Quantcast
Channel: How to access the Application[] collection from a WCF web service - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How to access the Application[] collection from a WCF web service

$
0
0

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.

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.

So, here's my service contract :

[ServiceContract]public interface IFlusherServicePage{    [OperationContract]    void FlushApplicationCache();}

Here's my implementing class :

public class FlusherServicePage : Page, IFlusherServicePage{    public void FlushApplicationCache()    {        Application.Clear();    }}

And here's my .svc file :

<%@ ServiceHost Language="C#" Debug="true" Service="FlusherServicePage" CodeBehind="~/App_Code/FlusherServicePage.cs" %>

Everything compiles fine. However, when I call my webservice, FlushApplicationCache() throws a NullReferenceException, because Application[] is null.

Is there any way to access the Application[] collection from a WCF webservice? Or do I need to go back to .ASMX?


Viewing all articles
Browse latest Browse all 2

Trending Articles