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

后端 未结 2 1997
被撕碎了的回忆
被撕碎了的回忆 2021-01-16 05:54

I have a MyService class implementing IService1 and IService2 interfaces. I would like to expose these two contracts on two separate e

相关标签:
2条回答
  • 2021-01-16 06:20

    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 讨论(0)
  • 2021-01-16 06:21

    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>
    
    0 讨论(0)
提交回复
热议问题