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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:23:13+00:00 2026-06-13T09:23:13+00:00

I’ve got a WCF service where i’m trying to get callbacks working. The Interface

  • 0

I’ve got a WCF service where i’m trying to get callbacks working.

The Interface class looks like:

[ServiceContract(
    SessionMode = SessionMode.Required,
    CallbackContract = typeof(IPredatorEngineCallback))]
public interface IMyApplication
{
    [OperationContract]
    Boolean DoSomething(string mystring);

    [OperationContract]
    Boolean SubscribeToEvent();

}

public interface IMyApplicationCallback
{
    [OperationContract (IsOneWay = true)]
    void EventRaised(EventMessage myEventMessage)
}

EventMessage is class which is in a comms library shared by the server & client.

The implementation of this interface looks like:

[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple)]
public class MyApplication : IMyApplication
{
    private List<IMyApplicationCallback> CallbackList = new List<IMyApplicationCallback>;

    public Boolean DoSomething(string mystring)
    {
           // Do stuff

           // Now Raise an event
           PublishEvent();

           return true;
    }

    public Boolean SubscribeToEvent()
    {    
        IMyApplicationCallback IMAC = OperationContext.Current.GetCallbackChannel<IMyApplicationCallback>();
        if (!Callbacklist.Contains(IMAC)
           Callbacklist.Add(IMAC);
    }

    private void PublishEvent()
    {
        EventMessage myEM = new EventMessage();

        // Populate myEM.Fields

        Callbacklist.ForEach(delegate(IMyApplicationCallback callback)
        { callback.EventRaised(myEM); });
    }
}

The idea is that a client can choose to subscribe to receiving events.

I built my app in stages and immediately prior to implementing callbacks, the service works fine. Calls made to DoSomething() do what they are supposed to do and return pretty much immediately.

Now that i’ve implemented CallBacks, if I comment out the RaiseEvents() line in DoSomething it returns immediately.

My Client code now calls SubscribeToEvent() first, then makes a second call to DoSomething().

If I uncomment it and follow through with the debugger, I see that DoSomething finishes nicely pretty much immediately – no delay. I’ve got both the client & WCF service running on same machine with VS2010. I follow it through to the closing } in DoSomething().

However, the callback function in my client isn’t called. After 1 minute it finally did get called and, I also got an error message stating that my original call had timed out. So I changed app.config to reduce to 10 seconds and the error message is:

"This request operation sent to http://localhost:8732/Design_Time_Addresses/MyApplication/MyAppication did not receive a reply in the configured timeout (00:00:09.987997). The time allotted to this operation may have been a portion of a longer timeout..."

So it appears that something is blocking the return of the first call; but the event has been raised because it eventually gets there. I suspect this is to do with locking/concurrencymode but i’ll admit that i’m lost for a solution.

On the client side i’ve used the proxy code generated by adding a service reference.

Server side app.config (relevant parts only):

</configuration>

Client side App.config:

<configuration>
<system.serviceModel>
    <bindings>
        <wsDualHttpBinding>
            <binding name="WSDualHttpBinding_IPredatorEngine" closeTimeout="00:00:10"
                openTimeout="00:00:10" receiveTimeout="00:10:00" sendTimeout="00:00:10"
                bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00" />
                <security mode="Message">
                    <message clientCredentialType="Windows" negotiateServiceCredential="true"
                        algorithmSuite="Default" />
                </security>
            </binding>
        </wsDualHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:8732/Design_Time_Addresses/MyApplication/MyApplication/"
            binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IMyApplication"
            contract="MyApplication.IMyApplication" name="WSDualHttpBinding_IMyApplication">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>
</configuration>

I assume i’ve not got something configured right. Can anyone spot it ?

  • 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-06-13T09:23:14+00:00Added an answer on June 13, 2026 at 9:23 am

    After much searching and trial and error, I found that I needed to set the SynchronizationContext to false.

    [ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, UseSynchronizationContext=false)]
    

    I also needed to set the following on the implementation of the Client side code:

    [CallbackBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.