Answered by:
Using WCF Service Library and IIS

Question
-
User686339638 posted
Most of what I hear online is that its best to use the WCF Service Library because it is more flexible and can be used with a variety of hosts. Yet i also notice that most websites that use the WCF Service Library also end up co-opting the WCF Service Application to get it to run on IIS. Is this the only way? Can it be done without using the WCF Service Application? I'm using VS 2010 and the .NET 3.5 framework, but I'm also interested it later frameworks as well.
I've heard that there are limitations to using the WCF Service Library. Nigel Shaw made a comment to that effect here: http://stackoverflow.com/questions/1423065/what-is-the-purpose-of-wcf-service-library
Thanks for any information you can provide!</div>
Tuesday, November 12, 2013 10:49 PM
Answers
-
User686339638 posted
Ok here is the answer.
Basically since it is a library, that is all it is. I need to do more to be able to host it.
A WCF Service Library has to be hosted in order to be used - you can host it in IIS, a Windows Service or some self-hosted option (like a console app, WinForm, WPF, etc).
In the last two links you provide, they're demonstrating how to host the library in an ASP.NET service application, but you don't have to use that project template to host it. It's simply one option out of several.
You can create an IIS-hosted implementation of your class library without using a VS project template, but you'll need to manually add the .svc file and the Web.config. I have done this several times:
- Create a folder (I normally put mine in the
wwwroot
folder ofinetpub
, but you can put it wherever you desire). - Create a
bin
folder in the folder you created in step 1, and put the WCF service library and any other required assemblies in it. - Add a .svc file with the appropriate markup in the folder created in step 1.
- Add a Web.config with the appropriate service model configuration in the folder created in step 1.
- Create an application in IIS that points to the folder you created.
Now you have an IIS-hosted instance of your service. You can then use another copy of the WCF service library for your Windows-Service hosted instance.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, November 14, 2013 12:22 PM - Create a folder (I normally put mine in the
All replies
-
User686339638 posted
Ok here is the answer.
Basically since it is a library, that is all it is. I need to do more to be able to host it.
A WCF Service Library has to be hosted in order to be used - you can host it in IIS, a Windows Service or some self-hosted option (like a console app, WinForm, WPF, etc).
In the last two links you provide, they're demonstrating how to host the library in an ASP.NET service application, but you don't have to use that project template to host it. It's simply one option out of several.
You can create an IIS-hosted implementation of your class library without using a VS project template, but you'll need to manually add the .svc file and the Web.config. I have done this several times:
- Create a folder (I normally put mine in the
wwwroot
folder ofinetpub
, but you can put it wherever you desire). - Create a
bin
folder in the folder you created in step 1, and put the WCF service library and any other required assemblies in it. - Add a .svc file with the appropriate markup in the folder created in step 1.
- Add a Web.config with the appropriate service model configuration in the folder created in step 1.
- Create an application in IIS that points to the folder you created.
Now you have an IIS-hosted instance of your service. You can then use another copy of the WCF service library for your Windows-Service hosted instance.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, November 14, 2013 12:22 PM - Create a folder (I normally put mine in the
-
User686339638 posted
I thought I'd let any future guys see the path i went. I also posted this on some other threads and thought I'd post it here since more places may help people quicker in the future since similar questions keep coming up and it took me days to get an answer.
For a more detailed answer explaining the difference between a WCF Service Library and WCF Service Application check out the following link:
For an explanation of other options other than using templates to host the WCF Service Library then check out this link:
For an explanation of how to host it and publish the WCF Service, check out this link:
You should be able to follow these links pretty much step-by-step. I was able to skip the second method and use both the WCF Service Libary and the WCF Service Application and then follow the steps in the last link.
I hope this information helps someone speed up there research. It took me several days to figure all his out and I have two books I've read on the subject.
Thursday, November 14, 2013 12:57 PM