Tutorial :Move WCF service from test console app to IIS


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


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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »