Reputation: 89
I have a service object which has method having callback implementation mentioned below
public string GetMacName()
{
string value = System.Environment.MachineName.ToString();
msgCallback = OperationContext.Current.GetCallbackChannel<IServiceCallBack>();
msgCallback.Notify(value);
return value;
}
I have created a DuplexChannelfactory and got the service object in my client. Now, with the service object I retrieve Type as Client Side:
DuplexChannelFactory<IServiceOne> factory = new DuplexChannelFactory<IServiceOne>(callbackInstance, new NetTcpBinding(), "uri");
proxyObject = factory.CreateChannel(); Type t= proxyObject.GetType();
I have implemented IServiceOneCallback method in client
public string Notify(string value)
{
Notification=value;
}
I am invoking the method GetMacName() as mentioned below:
t.Invoke("GetMacName", BindingFlags.Default | BindingFlags.InvokeMethod, null, proxyObject, args);
this is getting failed... where i m wrong,is something for callback needs to done in Invoke
Upvotes: 1
Views: 240
Reputation: 89
Got it working... [CallbackBehavior(ConcurrencyMode=ConcurrencyMode.Multiple,UseSynchronizationContext=false)] attribute needs to be added for wpf or winform application, something to do with synchronization context. Thank you for your inputs.
Upvotes: 0