From remoting to WCF - one contract many implementations RRS feed

  • Question

  • Hi

    I'm busy converting our remoting code to wcf. I've stumbled across something that was dead easy in remoting, but I'm starting to think is next to impossible in wcf.

    Our remoting code exposes a variety of "update" services used to update various entities in our system. Each update could be implemented a different way, but they all expose the same interface to the consuming application. Now back in the day we tied a remoting uri directly to an object in a library (using <wellknown>). The website would dynamically lookup which uri was needed for which entity and then use Activator.GetObject to get a reference to the service on the app server (type cast to the generic interface, not the specific implementation). That was dead easy.

    Now I'm trying to do the same in wcf. I always assumed it would be pretty easy, but now that I'm actually trying to do it, it looks almost impossible. The problem from what I can see is that, unlike remoting, endpoints do not directly specify who actually implements the contract, I'm guessing that is done by the service host. If you read "Venkat Chilakala - MSFT "'s reply here you'll see he mentions the key part: " What uniquely identifies a service is the combination of the following: Address+Contract+Binding"

    So from what I can see it's not really possible to have 2 different implementations of the same contract in your wcf host.

    Anyone have any bright ideas? I'm guessing I'm going to have to write some sort of behaviour or something to intercept the instantiation on the server side and do it dynamically based on the address I pass in?

    • Edited by Greg Nagel Monday, September 21, 2009 1:47 PM typo
    Monday, September 21, 2009 1:46 PM


  • Hi Greg,

    I think that you can create one new ServiceHost object for new implementation to satisfy your requirement here if you are using Self-Host. If you use IIS to host WCF service, just add one new WCF service for new implementation. Let us know whether this can fix the current issue. If you have any further issues, feel free to tell us.

    Best regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, September 24, 2009 5:54 AM