none
Transition from .Net Remoting to WCF RRS feed

  • Question

  • We are in the process of converting our Vb.Net 2.0 remoting application to WCF version 4.6 …

    With remoting on our DAL (Data Access Layer Service) we are Registering our “WellKnownService” types like this:

     

    System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(GetType(BusinessObjects.Dal.fmFormula), "Formula.rem", Runtime.Remoting.WellKnownObjectMode.SingleCall
    System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(GetType(BusinessObjects.Dal.fmResource), "Resource.rem", Runtime.Remoting.WellKnownObjectMode.SingleCall)
    System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(GetType(BusinessObjects.Dal.fmProperty), "Property.soap", Runtime.Remoting.WellKnownObjectMode.SingleCall)

    We have approx. 40 well known service types.  All of them implement their respective interfaces, for example IBusinessObjects.Dal.IFormula.   Our DAL service will ALWAYS be in a windows service using TCP binding.

    Should we create a “ServiceHost” for each one of our interfaces? 

    Like this:

    Dim binding As New System.ServiceModel.NetTcpBinding
    Dim baseAddress As System.Uri
    Dim host As System.ServiceModel.ServiceHost
     
    ‘Formula Object Data
    baseAddress = New System.Uri("net.tcp://localhost:8080/FormulaData")
    host = New System.ServiceModel.ServiceHost(GetType(BusinessObjects.Dal.fmFormula), baseAddress)
    host.AddServiceEndpoint(GetType(IBusinessObjects.Dal.IFormula), binding, baseAddress)
    host.Open()
     
    ‘Resource Object Data
    baseAddress = New System.Uri("net.tcp://localhost:8080/ResourceData")
    host = New System.ServiceModel.ServiceHost(GetType(BusinessObjects.Dal.fmResource), baseAddress)
    host.AddServiceEndpoint(GetType(IBusinessObjects.Dal.IResource), binding, baseAddress)
    host.Open()
     
    'Property Object Data
    baseAddress = New System.Uri("net.tcp://localhost:8080/PropertyData")
    host = New System.ServiceModel.ServiceHost(GetType(IBusinessObjects.Dal.fmProperty), baseAddress)
    host.AddServiceEndpoint(GetType(IBusinessObjects.Dal.IProperty), binding, baseAddress)
    host.Open()

    We want to make sure we are going down the correct path and is it okay to have 30 to 40 service host?

    Thanks,

    Rob

    Thursday, October 22, 2015 2:42 PM

Answers

  • The WCF service should just set reference to the DAL and consume the DAL. The WCF service Operational Contracts should create DAL objects and use the methods of the DAL objects.

    You could have just one WCF service to point to. But on the other hand, some like to segregate the services so that some functionality in a WCF service that terminates the WCF service doesn't bring down other service functionality if all functionality was in one service. If one WCF service terminates and the one services is segregated, then only that one WCF service is affected and any solution that was using the service would be affected, and not the whole shooting match.  

    You may also want to think about having a Service layer project that consumes the WCF services that sits between the BLL and the DAL where the BLL goes through the Service layer using a Interface on the Service layer than in turn consumes the WCF services. 

    Thursday, October 22, 2015 5:05 PM
  • http://martinfowler.com/eaaCatalog/serviceLayer.html

    The Service Layer consumes all of the WCF services. The Service Layer uses an IService that implements all the methods that exposes the WCF service's methods. Each WCF service could have it's own Service Layer, or you can combine WCF service in a single Service Layer. 

    How to use a Service Layer is being shown in the link. You just have the Service Layer project consume the WCF service.

    http://polymorphicpodcast.com/shows/mv-patterns/

    Thursday, October 29, 2015 1:59 PM

All replies

  • The WCF service should just set reference to the DAL and consume the DAL. The WCF service Operational Contracts should create DAL objects and use the methods of the DAL objects.

    You could have just one WCF service to point to. But on the other hand, some like to segregate the services so that some functionality in a WCF service that terminates the WCF service doesn't bring down other service functionality if all functionality was in one service. If one WCF service terminates and the one services is segregated, then only that one WCF service is affected and any solution that was using the service would be affected, and not the whole shooting match.  

    You may also want to think about having a Service layer project that consumes the WCF services that sits between the BLL and the DAL where the BLL goes through the Service layer using a Interface on the Service layer than in turn consumes the WCF services. 

    Thursday, October 22, 2015 5:05 PM
  • Thanks for the reply.  

    We are using interfaces that will consume the WCF services, for example the ServiceHost has concrete class fmFormula (implements IFormula) and endpoint is IFormula.  Just want to make sure it will be okay to have 30 or 40 WCF ServiceHost objects and it won't cause any performance issues.  The way our classes are structured with out interfaces I don't see anyway to combine them into one Class / Service.

    Thanks,

    Rob


    Rob Panosh Advanced Software Designs

    Thursday, October 29, 2015 12:21 PM
  • http://martinfowler.com/eaaCatalog/serviceLayer.html

    The Service Layer consumes all of the WCF services. The Service Layer uses an IService that implements all the methods that exposes the WCF service's methods. Each WCF service could have it's own Service Layer, or you can combine WCF service in a single Service Layer. 

    How to use a Service Layer is being shown in the link. You just have the Service Layer project consume the WCF service.

    http://polymorphicpodcast.com/shows/mv-patterns/

    Thursday, October 29, 2015 1:59 PM