Reputation: 63
I'm trying to set duplex service. I have created 2 interfaces: the first - the interface which the server implement:
[ServiceContract(CallbackContract = typeof(IBackUpServiceCallback))]
public interface IBackUpService
with some methods which are implement by the serve and the second one:
public interface IBackUpServiceClient
which holds methods that the server is supposed to use when callback the client. The implement class name
BackUpServiceCallBack : IBackUpServiceClient
is at the client side.
The problem is - after I am adding the service - the compiler auto generate:
interface IBackUpServiceCallback
and demand me to implement it.
and i have 2 callback interfaces.
the first which i have implemented (BackUpServiceClalBack
) at the client side, and the second one name :IBackUpServiceCallback - and I cant control it (client Url is "tempuri..")
and even if BackUpServiceClalBack
implements IBackUpServiceCallback
- it doesn't get to the implement method during runtime.
I am working with wsDualHttpBinding Binding.
Any ideas?
Upvotes: 1
Views: 443
Reputation: 63
i figure out that i dont have to do "add service reference' at all. and becuse the client know's the Interface at design time i can use it.
now i wont have a genareted code calss. as well insted of Proxy i will use :
private DuplexChannelFactory<IBackUpService> factory;
private IBackUpService _proxy;
InstanceContext t = new InstanceContext(implementClass);
factory = new DuplexChannelFactory<IBackUpService>(t, "nameOfBinding");
_proxy = factory.CreateChannel();
and the binding itself will be at runtime.
Upvotes: 2