2

I was asked to split my WCF service into several different .svc files, one per each logical operation group. Now the question is that I must host them in the exact same address

http://somehost/ProjectX/

and I don't really know if I can put them in that exact same route because, although the .svc files have different names, their configuration files all share the name Web.config. How can I get around this? Should I use

http://somehost/ProjectX/Service1/Service1.svc
http://somehost/ProjectX/Service2/Service2.svc
...

?

User
  • 3,244
  • 8
  • 27
  • 48
  • What's wrong with them sharing a config if it is accessible? – Grant Thomas Aug 30 '11 at 08:34
  • 1
    Because I don't think I should separate services by logic and then merge them again in the same configuration file. – User Aug 30 '11 at 08:35
  • How is it "merging"? They each load their own copy - unless each of the services require _different_ configuration elements (where one should not know about the others'), then duplicating the configuration seems redundant, and if a setting changes in one you'll need to change them all. – Grant Thomas Aug 30 '11 at 08:38

1 Answers1

1

The services are able to share the base address by default, they just need to have different contracts (the end bits of the URLs). I wrote a post on this topic, but since then I stop paying for hosting and never had time to migrate the post. The code is still available on github and with a bit of persistence it should be easy to understand how to to that.

The project shows how to host many WCF services in one Windows service. It allows you to do this:

http://localhost:8083/WCFServices/IService1
http://localhost:8083/WCFServices/IService2
http://localhost:8083/WCFServices/IService3
oleksii
  • 35,458
  • 16
  • 93
  • 163
  • Sorry for bringing up an old post, but your link is dead. May want to put the information here or update it. Thanks! – James Ralston Jul 22 '15 at 16:49
  • hey @JamesRalston. Tnx for bringing this up. I stop paying for my hosting as my provider kept asking me for the billing password via email "to confirm my identity". I still have code on github but not much documentation :(. Hope it will still be ok for someone to look around the project to figure out how to do that. – oleksii Jul 23 '15 at 08:47