Does WCF support Marshal By Reference and COM Interops RRS feed

  • Question

  • Hi,

    We have been using .Net remoting for some time. We have wrapped our Interop objects in .Net classes and are exposed to our end users. We so far used MarshalByRef and used a standalone exe as .Net remoting server.

    Question 1:

    Now, we would like to move to WCF. Does WCF has MarshalByRef concept. If not, COM interops are not serializable and hence would have a problem when they are accessed from Client side.

    Question 2:

    Does WCF only expose Interfaces and not concrete classes? Our types are shared with client and hence we so far did not have interfaces. We have around 500 small classes that form a tree similar to Excel(workbook, sheets etc). So, this migration to WCF(if it only supports Interfaces) might be really difficult for us.

    Thank you for your answers.

    -Regards Phani Bhaskar

    Monday, August 11, 2014 11:09 AM


  • Hi,

    WCF does not support the support Marshal By Reference.
    For more information, please try to refer to this article with the following

    In my mind, the WCF can expose the concrete classes as following without Interfaces :
    public class TheService
       // more stuff here

    That said, it is recommended to separate them. Separating the contract from the implementation can give you some different advantages:

    • You can put the interfaces into a separate assembly. This assembly can be used by any piece of code that needs to know about the interface, but not necessarily about the implementation. I have used this sometimes to construct a sort of service gateway wrapping communication to the service.
    • You can have one class implement more than one interface. This means that you can expose the same implemented class in different ways using different interfaces in the WCF endpoints.
    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, August 12, 2014 3:32 AM