开发者

Adding information to my svcfile without a web-project?

I'm following this guide here:

http://www.lostechies.com/blogs/jimmy_bogard/archive/2008/09/16/integrati开发者_如何学Cng-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: Adding .svc file missing

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜