我有一个实现MyService
和IService1
接口的IService2
类。我想在两个不同的端点上公开这两个合同,例如:
IService1
在/Service/S1
IService2
在/Service/S2
这样的配置怎么样?
答案 0 :(得分:3)
试试这个......
<services>
<service name="Service">
<endpoint address="http://localhost:8080/Service/S1"
binding="basicHttpBinding"
contract="IService1"
/>
<endpoint address="http://localhost:8080/Service/S2"
binding="basicHttpBinding"
contract="IService2 "
/>
</service>
</services>
答案 1 :(得分:1)
您可以使用具有两个端点的服务,如下所示:
<services>
<service name="MyNamespace.MyService">
<endpoint address="/Service/S1"
binding="basicHttpBinding"
contract="IService1" />
<endpoint address="/Service/S2"
binding="basicHttpBinding"
contract="IService2 " />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/"/>
</baseAddresses>
</host>
</service>
</services>
编辑:添加了基地址