What is the difference between a WCF Service Application and a WCF Service Library?

45,189

Solution 1

A service application includes a website host already setup for you. A service library is a library of services that a host can reference and startup.

If you start with a service library (recommended) you can then choose any host you wish (a windows service, IIS/ASP.NET, or even a console application) and you'd just reference your library from your new host. Choosing a Service Application limits your host to just IIS/ASP.NET (though this might be ok for your purposes, but will limit the protocols you can use).

Edit: Changes in IIS since I wrote this allow for a wider variety of protocols on ASP.NET activated services, so choosing a service application is much less limiting than before.

Solution 2

If all you have is the one project I see only added complexity if you separate for the heck of it. I used a library when I had some particular use cases where I had to host in both a windows service and in IIS.

For IIS you you can move the classes and interfaces to a library but keep your .SVC files in the web project. You must edit the .SVC files to point to the properly qualified classes.

Share:
45,189
Ashish Ashu
Author by

Ashish Ashu

Updated on July 16, 2022

Comments

  • Ashish Ashu
    Ashish Ashu almost 2 years

    I am developing a WCF web service and I used the WCF Service Application template to do that.

    Does creating a "WCF Service Application" fulfill this requirement? What are the advantage of creating a WCF Service Library over a WCF Service Application?

  • Allen Rice
    Allen Rice about 12 years
    Anyone have info about the new protocols / bindings available when hosting on IIS?
  • Chiramisu
    Chiramisu over 11 years
    @AndersonImes I know this is an old post, but hoping you can help. I've been looking everywhere and can't find whether or not WCF Service is intended to replace Web Service in .NET 3.5 and thus why the template was removed in .NET 4? Thanks. :)
  • StoriKnow
    StoriKnow over 11 years
    @Chiramisu WCF provides many more advantages and flexibility ... I found these very helpful: Codeproject example , Stackoverflow question
  • Chiramisu
    Chiramisu over 11 years
    @Sam Thanks Sam, very helpful. So basically WCF can do everything a Web Service can and more? Any limitations I wonder... :)
  • StoriKnow
    StoriKnow over 11 years
    @Chiramisu glad to help! There's always limitations, but WCF has far less limitations than a typical web service, I'd imagine.
  • Tomas Kubes
    Tomas Kubes over 9 years
    If I want to test the WCF Service Library/App With unittest, do I need to use Library and not application?