Question

I have a windows service hosting a singleton WCF service which caches a large amount of data. On start up of the windows service I am doing the following:

// start client service
        wcfService= new ServiceHost(typeof(MyWcfService));
        wcfService.Open();

        using (HostedServiceReference.WcfServiceProxy wcfServiceProxy = new HostedServiceReference.WcfClientServiceProxy())
        {
            wcfServiceProxy.RefreshDisplayCacheFromSource();
            // 1st echo to console
            Console.WriteLine("Display Cache Refreshed"));
        }
        // 2nd echo to console
        Console.WriteLine("Begin other processing"))

and I have the method configured as follows in the service contract:

[OperationContract(IsOneWay=true)]
    void RefreshDisplayCacheFromSource();

I had expected to immediately see the 1st and 2nd echos displayed in the console, but what I am actually seeing is just the 1st echo. The 2nd line is not displayed until my "fire and forget" method has completed it's long operation.

Can anyone explain what is going on in the background?

My theories so far:

Is the operation of the wcf service in singleton mode blocking the service hosting it?

Is it something to do with the using statement?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top