Reputation: 35679
I've been building a WCF app behind 3 projects (contract,implementation,client) I've hosted my service as a console app with basic HTTP binding. I'm now ready to move it to IIS. However, the tutorial for creating a .svc file shows it actually implementing the contract - but I already have an implementation. How do I just redirect to that implementation or should I be adding a .svc file to my existing implementation project?
Hope that's clear enough.
Cheers, Rob
Upvotes: 2
Views: 667
Reputation: 16607
I normally add the SVC file in, and the ServiceHost will point to the same class that you would when you create a new instance of a ServiceHost from Code.
So your CommandLine host might look like:
using (ServiceHost serviceHost = new ServiceHost(typeof(CoolService.CoooolEndpoint)))
{
And your .svc file would look like:
<%@ ServiceHost Language="C#" Debug="false" Service="CoolService.CoooolEndpoint" %>
So now you have your app hostable in IIS and also from the commandline.
I normally just knock up the svc file when I am ready to deploy.
Paul.
Upvotes: 4