Reputation: 71
I have some problems with WCF service instances.
ChannelFactory<IMyInterface> factory = new ChannelFactory<IMyInterface>(new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8000"));
IMyInterface iFirst = firstFactory.CreateChannel();
iFirst.firstMethod();
IMyInterface iSecond = firstFactory.CreateChannel();
iSecond.secondMethod();
It works fine but creates two instances of service class on server side.
InstanceContextMode
is set to InstanceContextMode.PerSession
and I would like to keep it that way. I found this article:
http://msdn.microsoft.com/en-us/magazine/cc163590.aspx#S4
In section Duplicating a Proxy
is Figure 5 Duplicating a Proxy. I seems to be perfect solution but IClientChannel
no longer contains ResolveInstance()
method. Is there any other way to create two channels connected to one service instance without setting InstanceContextMode
to InstanceContextMode.Single
?
Upvotes: 2
Views: 398
Reputation: 10865
The IClientChannel.ResolveInstance method has been replaced with a new extensibility point, the System.ServiceModel.Dispatcher.IInstanceContextProvider interface.
The change is described here: http://blogs.msdn.com/b/mahjayar/archive/2006/07/08/660176.aspx - perhaps you can implement that interface to get what you want to acheive.
Upvotes: 1