I understand what the differences are between a WCF Library and a WCF Service. I typically will build a WCF Library and reference it from a WCF Service. But if I am going to deploy to IIS, why not just deploy the WCF Library and forget about creating the WCF Service. Does it matter which one I deploy?
-
Possible duplicate of [What is the difference between a WCF Service Application and a WCF Service Library?](http://stackoverflow.com/questions/1204365/what-is-the-difference-between-a-wcf-service-application-and-a-wcf-service-libra) – lokusking Jul 15 '16 at 20:38
-
No this question is not a duplicate. This question asks if there is any benefit in using one over the other in the context of an IIS host. – user3366675 Jul 15 '16 at 21:17
-
IIS tends to be more robust in terms of logging and error handling. A service library gives you the advantage of hosting the service in IIS or other hosts (or even multiple hosts) and separation of code. You can also very easily run WCFTestClient against a WCF service application. If you are only going to host in IIS, then the service application is probably best. Functionally, a WCF service application and a WCF service library are equivalent. – Tim Jul 15 '16 at 21:33
-
I normally would agree that hosting a service would be better than hosting a library, but I want to know for sure if that is true. – user3366675 Jul 15 '16 at 21:41
-
@user3366675 - You're asking a question that has multiple valid answers. It really depends on the requirements of the project/application. If you're only going to host it in IIS, the Service Application is prefectly fine. If you think you might host the service in other ways (e.g., Windows Service), then you'll want to use a Library to avoid code duplication. I've done it both ways, but I *generally* tend to go with Service Application. – Tim Jul 15 '16 at 22:04
-
Tim, I agree with you that a Service Application would work fine in IIS. But why not just use the library, since it is more versatile anyway, and then just forget that Microsoft ever developed a WCF Service project? If the service project can't do anything more than the library, then what is the point of it. – user3366675 Jul 15 '16 at 22:35
1 Answers
Answering my own question: From what I have read it doesn't seem to matter much if you deploy a wcf library or a wcf service. If you deploy the library, make sure that you copy the contents of your app config file to the web config file. The wcf service does also provide an svc file, but you only need that if you are using an earlier version of .net framework other than 4.0 or later. If you deploy the service instead of the library, the App config file for the service will pass the content onto the Web.config file when it is deployed. I am pretty sure that these are the only differences. The two people that replied to my question didn't really take the time to read and understand the question. It got marked as a possible duplicate, which clearly it is not.

- 85
- 1
- 5