Sahil Sharma
Sahil Sharma

Reputation: 37

Host Multiple Wcf Services On Local IIS 6

I have tried to google a lot to find a solution to how to host multiple WCF web services on local IIS 6.

So i am asking here. If I can get a step of procedure then i would be glad.

Upvotes: 0

Views: 249

Answers (1)

jtabuloc
jtabuloc

Reputation: 2535

To accomplish your goal this is how to do it:

  • Create your new solution or just reuse current solution you have.
  • Create new Project under Visual C# and select WCF Service Application. For sample purposes we name it MultipleHostService project.
    • It will produce three files named IService1.cs, Service1.svc and Web.config
  • Under your MultipleHostService project add another New item, under Visual C# Select WCF Service and leave name as is.
    • It will product addition two files named Iservice2.cs and Service2.svc
  • Open your Web.Config add Behaviors and Binding configuration highlighted with red box.

enter image description here

If you notice we added Services node and service under it? That is the part that allows us to specify multiple services.

Tools and settings I've used:

  • Visual Studio 2013
  • IIS 7
  • .Net Framework 4.5

Improvements :

  • You can refactor proper naming for your services.
  • Remove unnecessary XML node in the configuration file like unused behavior.

Disclaimer : I haven't tested it using IIS 6 but I'm confident that it works on IIS7. Configuration about IIS is not part of this topic so you migt run some issues which I'm not aware of. There are also some other ways to accomplish multiple hosting of services but this topic is focusing on usage of configuration file. And please do some study on proper Bindings, Behavior and MetaDataExhange which I didn't discuss here.

Upvotes: 2

Related Questions