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

2

120

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?

Literally answered 30/7, 2009 at 3:46 Comment(0)
I
149

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.

Intrusive answered 30/7, 2009 at 4:34 Comment(6)
Anyone have info about the new protocols / bindings available when hosting on IIS?Garnierite
@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. :)Topeka
@Topeka WCF provides many more advantages and flexibility ... I found these very helpful: Codeproject example , Stackoverflow questionDenisdenise
@Sam Thanks Sam, very helpful. So basically WCF can do everything a Web Service can and more? Any limitations I wonder... :)Topeka
@Topeka glad to help! There's always limitations, but WCF has far less limitations than a typical web service, I'd imagine.Denisdenise
If I want to test the WCF Service Library/App With unittest, do I need to use Library and not application?Linseed
E
10

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.

Elephant answered 30/7, 2009 at 4:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.