简体   繁体   中英

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.

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.

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM