views:

10

answers:

1

I'm following this guide here:

http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/09/16/integrating-structuremap-and-nhibernate-with-wcf.aspx

And has now come to the end of it where i need to add :

<%@ ServiceHost Language="C#" Debug="true" Service="Wcf.ComboService" Factory="Wcf.DIServiceHostFactory" %>

to my svcfile, the problem is that i dont have an svcfile and according to this post you must add a reference from a Web-application to get it: http://stackoverflow.com/questions/1480233/adding-svc-file-missing

Is there really no way to do this? or maybe make this code work without the svc-file?

+1  A: 

An .svc file is just a text file with a different extension, so you can always add it as a text file, no matter what sort of Visual Studio solution you use.

It's not compiled, but rather sits alongside the WCF binaries, instructing IIS on how to create service instances. If configured correctly, IIS interprets the .svc file and spins up the service from the binaries.

However, if you don't want to host your service in IIS, you don't need an .svc file. You can just use the ServiceHostFactory to manually spin up the service:

var factory = new Wcf.DIServiceHostFactory();
var host = factory.CreateServiceHost(typeof(Wcf.ComboService), baseAddresses);
host.Open();

This is called self-hosting.

Mark Seemann