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 5931403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:41:22+00:00 2026-05-22T14:41:22+00:00

I have a windows service hosting a singleton WCF service which caches a large

  • 0

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?

  • 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-22T14:41:23+00:00Added an answer on May 22, 2026 at 2:41 pm

    The proxy object for the WCF Service will be disposed of at the end of the using block, but this cannot happen until the client receives acknowledgement that the service received its message. It seems that the service does not send the acknowledgement until it had executed all the code in the method body (including processing the large amount of data), therefore execution on the client waits at the end of the using block until the service has finished its processing.

    There are 2 ways I was able to use to get around this issue:

    Make the proxy object a global variable in the client.

    Spin off a thread in the server to handle the long processing, allowing the server method to return immediately with the acknowledgement the client is waiting for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service and am hosting it in a Windows Service. I
I have six wcf services that I'm hosting in a windows service. Everything works
I have a windows service hosting several WCF services. In my windows service I
I have a wcf service that I am hosting within a windows service on
We have an windows service written in .net, that is hosting WCF service. My
I have a Windows Service that is self hosting a Wcf service, this Wcf
I have created a windows service for the sole purpose of hosting a WCF
I have a simple Windows Service hosting a WCF Service. I want to run
I have a Windows Service written in Delphi which runs a number of programs.
I have a WCF service which is hosted on IIS6 on a Win2003 SP2

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.