开发者

WCF config for a service class implementing multiple contracts on separate endpoints

I have a MyService class implementing IService1 and IService2 interfaces. I would like to expose these two contracts on two separate en开发者_如何学Godpoints, like:

  • IService1 exposed on /Service/S1
  • IService2 exposed on /Service/S2

How would such a config look like?


Try this....

<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>


You can just use a service with two endpoints, like this:

<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>

EDIT: Added base address

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜