Run WCF ServiceHost with multiple contracts

前端 未结 8 2245
长发绾君心
长发绾君心 2020-11-27 14:09

Running a ServiceHost with a single contract is working fine like this:

servicehost = new ServiceHost(typeof(MyService1));
servicehost.AddServiceEndpoint(typ         


        
8条回答
  •  天命终不由人
    2020-11-27 14:33

    What about splitting it up with a base address and multiple services/contracts below it? I am not behind a developmachine right now but something like:

    http://myserver/myservices/serviceA
    http://myserver/myservices/serviceB
    http://myserver/myservices/serviceC

    Each service implementing its own ServiceContract.

    You can change
    public class WcfEntryPoint : IMyService1, IMyService2
    to
    public partial class WcfEntryPoint : IMyService1
    public partial class WcfEntryPoint : IMyService2

    Example

提交回复
热议问题