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

  • Home
  • SEARCH
  • 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 644719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:25:25+00:00 2026-05-13T21:25:25+00:00

I have created a web application with a Silverlight project embedded in it, using

  • 0

I have created a web application with a Silverlight project embedded in it, using VS 2008 SP 1, and the Silverlight 3 tools, on Vista and Windows 7.

The duplex service code:

    [ServiceContract(Namespace = "cotoco", CallbackContract = typeof(IDuplexClient))]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class DuplexServer
{
private IDuplexClient _client;
private string _message;
private int _messageCounter;

private Timer _timer;

public DuplexServer()
{
}

#region IDuplexServer Members

[OperationContract(IsOneWay = true)]
public void SendEcho(string message)
{
    _client = OperationContext.Current.GetCallbackChannel<IDuplexClient>();
    _message = message;

    _timer = new Timer();
    _timer.Interval = 2000;
    _timer.Enabled = true;
    _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
    _timer.Start();
}

void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
    _client.ReturnEcho(string.Format("Duplex Echo {0}: {1}", _messageCounter, _message));

    _messageCounter++;
    if (_messageCounter > 5)
        _timer.Dispose();
}

    #endregion
}

[ServiceContract]
public interface IDuplexClient
{
    [OperationContract(IsOneWay = true)]
    void ReturnEcho(string message);
}

The duplex config section:

<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name=”DuplexServerBehavior”>
<serviceMetadata httpGetEnabled=”true” />
<serviceDebug includeExceptionDetailInFaults=”false” />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled=”true” />
<services>
<service behaviorConfiguration=”DuplexServerBehavior” name=”DuplexServer”>
<endpoint address=”” binding=”wsDualHttpBinding” contract=”DuplexServer” />
<endpoint address=”mex” binding=”mexHttpBinding” contract=”IMetadataExchange” />
</service>
</services>
</system.serviceModel>

I have setup a Duplex service in the client application as follows:

        Binding svcBinding;
        EndpointAddress svcAddress;

        svcBinding = new PollingDuplexHttpBinding() { UseTextEncoding = true };
        svcAddress = new EndpointAddress("http://localhost/CTC.Test.WCF.Server/DuplexServer.svc");
        _duplex = new DuplexServerClient(svcBinding, svcAddress);

I have used a Simplex service in tandem with this, and calls to the Simplex service hit the breakpoints setup on the server and i can step through.

Calls to the Duplex service do not hit the breakpoints, although no error is raised on the client. If i inspect the HTTP traffic with Fiddler, i can see hundreds of 202 requests being fired after the initial request – i assume these are the polling requests.

Initial Duplex Request:

POST http://localhost/CTC.Test.WCF.Server/DuplexServer.svc HTTP/1.1
Accept: /
Content-Length: 665
Content-Type: application/soap+xml; charset=utf-8
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; (R1 1.6); SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Host: cotocovista4.cotoco.local
Connection: Keep-Alive
Pragma: no-cache

<s:Envelope xmlns:a=”http://www.w3.org/2005/08/addressing&#8221; xmlns:s=”http://www.w3.org/2003/05/soap-envelope”><s:Header><a:Action s:mustUnderstand=”1″>urn:IDuplexServer/SendEcho</a:Action><netdx:Duplex xmlns:netdx=”http://schemas.microsoft.com/2008/04/netduplex”><netdx:Address&gt;http://docs.oasis-open.org/ws-rx/wsmc/200702/anonymous?id=ae3e3139-0df8-41eb-97db-69c2c48782b7</netdx:Address><netdx:SessionId>43f9e320-cde3-4e21-a748-e5b29c10ee25</netdx:SessionId></netdx:Duplex><a:To s:mustUnderstand=”1″>http://cotocovista4.cotoco.local/CTC.Test.WCF.Server/DuplexServer.svc</a:To></s:Header><s:Body><SendEcho><message>Message!</message></SendEcho></s:Body></s:Envelope&gt;

Subsequent Duplex Requests:

POST http://localhost/CTC.Test.WCF.Server/DuplexServer.svc HTTP/1.1
Accept: /
Content-Length: 588
Content-Type: application/soap+xml; charset=utf-8
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; (R1 1.6); SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Host: cotocovista4.cotoco.local
Connection: Keep-Alive
Pragma: no-cache

<s:Envelope xmlns:a=”http://www.w3.org/2005/08/addressing&#8221; xmlns:s=”http://www.w3.org/2003/05/soap-envelope”><s:Header><a:Action s:mustUnderstand=”1″>http://docs.oasis-open.org/ws-rx/wsmc/200702/MakeConnection</a:Action><a:To s:mustUnderstand=”1″>http://cotocovista4.cotoco.local/CTC.Test.WCF.Server/DuplexServer.svc</a:To></s:Header><s:Body><wsmc:MakeConnection xmlns:wsmc=”http://docs.oasis-open.org/ws-rx/wsmc/200702″><wsmc:Address&gt;http://docs.oasis-open.org/ws-rx/wsmc/200702/anonymous?id=ae3e3139-0df8-41eb-97db-69c2c48782b7</wsmc:Address></wsmc:MakeConnection></s:Body></s:Envelope&gt;

Does anyone know why this would happen, i thought I’d finally sussed the last problem when it stopped throwing connection exceptions….

Regards

Tris

Update: I have tried recreating this in the following project types: WCF Application, Web Application, Web Project. I have succeeded in implementing the MS Example that uses WCF Message’s for the Duplex parameters without problem, but i was looking for a rapid way of assembling duplex web services using WSDL.

  • 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-13T21:25:25+00:00Added an answer on May 13, 2026 at 9:25 pm

    So – i managed to finally get it working using the following web config section, and adjusting the client side accordingly:

    <system.serviceModel>
    
    <extensions>
      <bindingElementExtensions>
        <add name="pollingDuplex"
             type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex"/>
      </bindingElementExtensions>
    </extensions>
    
        <bindings>
            <customBinding>
                <binding name="DuplexConfig">
                    <binaryMessageEncoding/>
                    <pollingDuplex maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:05:00"/>
                    <httpTransport/>
                </binding>
            </customBinding>
        </bindings>
    
        <behaviors>
            <serviceBehaviors>
                <behavior name="CTC.Test.WCF.Server.DuplexServiceBehavior">
                    <serviceMetadata httpGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                    <serviceThrottling maxConcurrentSessions="2147483647"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
    
        <services>
            <service behaviorConfiguration="CTC.Test.WCF.Server.DuplexServiceBehavior" name="CTC.Test.WCF.Server.DuplexService">
                <endpoint address="" binding="customBinding" bindingConfiguration="DuplexConfig" contract="CTC.Test.WCF.Server.IDuplexService"/>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            </service>
        </services>
    
    </system.serviceModel>
    

    If anyone can explain why this worked, but using wsDualHttpBinding did not, that would be really helpful. 🙂

    (Also – why is that displayed in a code block? :/ )

    Regards

    Tristan

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

Sidebar

Ask A Question

Stats

  • Questions 357k
  • Answers 357k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The other answers are correct. Here is some code you… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer you ruin the noConflict concept by reassigning the jquery to… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer If you get that particular error, you don't actually have… May 14, 2026 at 9:40 am

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.