locked
difference between Add Reference and Add Services Reference in WCF RRS feed

  • Question

  •  

     

    I have created a WCF Services called wcfProcess1 and hosted thru WcfSvcHost

    I am consuming the wcfProcess1 in another windows program by calling by adding as Add Reference, DLL of the wcfProcess1 from Bin folder and not by adding as Add Services Reference.

    Is this correct way to do?

    By adding the DLL Reference as Add Reference i am still able to consume the wcfProcess1

    What are the advantages and disadvantages of it?

     What is the difference between Add Reference and Add Services Reference in the client program when consuming the wcfProcess1?

      

    Regards,

    Thomas

     

    Wednesday, October 6, 2010 12:21 PM

Answers

  • Hi

    Add reference will add a .NET reference to the DLL for the service. When you call the method on the service class you are calling the class directly and not consuming the functionality as a service.

    Adding a service reference will create client proxy code that allows you to call the functionality as a service over a protocol (eg. TCP, HTTP).

    Adding a DLL reference really defeats the object of developing services. Your client will have the functionality, but it will be executed in the client process.

    Adding a service reference allows you to call the service across machine boundries, and is the perfered option to explore for WCF development.

    Regards,

    Alan

     


    http://www.CloudCasts.net - Community Webcasts Powered by Azure
    • Marked as answer by Shaju Thomas Thursday, October 7, 2010 5:05 AM
    Wednesday, October 6, 2010 1:57 PM

All replies

  • On 10/6/2010 8:21 AM, Shaju Thomas wrote:
    > I have created a WCF Services called wcfProcess1 and hosted thru WcfSvcHost
    >
    > I am consuming the wcfProcess1 in another windows program by calling by
    > adding as Add Reference, DLL of the wcfProcess1 from Bin folder and not
    > by adding as Add Services Reference.
    >
    > Is this correct way to do?
    >
    > By adding the DLL Reference as Add Reference i am still able to consume
    > the wcfProcess1
    >
    > What are the advantages and disadvantages of it?
    >
    > What is the difference between Add Reference and Add Services Reference
    > in the client program when consuming the wcfProcess1?
    >
     
    If you were doing an ASP.NET WCF Web service, you would for sure use
    Services Reference. If you are just using a DLL that has the WCF service
    that's being hosted, then you use Add Reference.
     
    Wednesday, October 6, 2010 1:25 PM
  • Hi

    Add reference will add a .NET reference to the DLL for the service. When you call the method on the service class you are calling the class directly and not consuming the functionality as a service.

    Adding a service reference will create client proxy code that allows you to call the functionality as a service over a protocol (eg. TCP, HTTP).

    Adding a DLL reference really defeats the object of developing services. Your client will have the functionality, but it will be executed in the client process.

    Adding a service reference allows you to call the service across machine boundries, and is the perfered option to explore for WCF development.

    Regards,

    Alan

     


    http://www.CloudCasts.net - Community Webcasts Powered by Azure
    • Marked as answer by Shaju Thomas Thursday, October 7, 2010 5:05 AM
    Wednesday, October 6, 2010 1:57 PM
  • Thank you Alan
    Thursday, October 7, 2010 5:06 AM
  • Hi Alan, Or any other Reader interested.

    What if you were developing a Windows Service ? (say BrushMyTeethService)  If I want to be able to start and stop my service from remote server, and a need some class library in my service (say ToothBrush). Do I a need to add this library as a service reference ?

    Did I understand you correctly that if I say that  I can add a reference to ToothBrush in BrushMyTeethService as the projects that I need for my service to work or not services themselves, and I do not plan for ToothBrush or any of it's classes to become services themselves in the future.

    (So add reference , and not add service reference)

    (And if they do anyway , I will change it later)

    concerning dental hygiene:

    http://www.google.nl/url?sa=t&source=web&cd=1&ved=0CBIQFjAA&url=http%3A%2F%2Fwww.improvingyourworld.com%2Fhealth%2Fwhy_good_dental_hygiene_is_so_important_to_your_health_002315.html&ei=HaIUTdi7GNSr8QPqsqGEBw&usg=AFQjCNGN0FOXQitPEVs7upN_NPIzPSIGQw

    Friday, December 24, 2010 1:38 PM