Bugzilla – Attachment 436994 Details for
Bug 702532
DuplexClientBase Channel Initialization Broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
Example Application To Reproduce
Program.cs (text/plain), 1.92 KB, created by
John Hargrove
on 2011-06-28 04:51:06 UTC
(
hide
)
Description:
Example Application To Reproduce
Filename:
MIME Type:
Creator:
John Hargrove
Created:
2011-06-28 04:51:06 UTC
Size:
1.92 KB
patch
obsolete
>using System; >using System.Collections.Generic; >using System.Linq; >using System.Text; >using System.ServiceModel; >using System.Threading; >using System.ServiceModel.Channels; > >namespace Jgh.Test >{ > class Program > { > [ServiceContract(CallbackContract = typeof(ITestCallbackContract))] > interface ITestContract > { > [OperationContract] > int Add(int a, int b); > } > > interface ITestCallbackContract > { > [OperationContract] > void Say(string what); > } > > class TestCallbackClient : ITestCallbackContract > { > public void Say(string what) > { > Console.WriteLine("Callback says: {0}", what); > } > } > > [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] > class TestServer : ITestContract > { > public int Add(int a, int b) > { > var callbackChannel = OperationContext.Current.GetCallbackChannel<ITestCallbackContract>(); > callbackChannel.Say(string.Format("Adding {0} and {1} is {2}!", a, b, a + b)); > return a + b; > } > } > > class TestDuplexClient : DuplexClientBase<ITestContract>, ITestContract > { > public TestDuplexClient(ITestCallbackContract callback, Binding binding, EndpointAddress address) : base(callback, binding, address) { } > public int Add(int a, int b) > { > return this.Channel.Add(a, b); > } > } > > static void Main(string[] args) > { > var wcfService = new TestServer(); > var wcfServiceHost = new ServiceHost(wcfService); > wcfServiceHost.AddServiceEndpoint(typeof(ITestContract), new NetTcpBinding(SecurityMode.None, false), "net.tcp://localhost:15201/Test"); > wcfServiceHost.Open(); > > var client = new TestDuplexClient(new TestCallbackClient(), new NetTcpBinding(SecurityMode.None, false), new EndpointAddress("net.tcp://localhost:15201/Test")); > client.Open(); > Console.WriteLine("Adding server result: " + client.Add(50, 25)); > > Console.ReadLine(); > > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 702532
: 436994