locked
WCF With Multiple Endpoints with single base address for same Service,binding and contract RRS feed

  • Question

  • User862083299 posted

    Hi,

    I am working on sample WCF project and got a scenario like can we have multiple endpoints for same service with same binding and same contract and with single base address as shown below.

      <system.serviceModel>
        <services>
          <service name="MyMathServiceLib.MyMathService" behaviorConfiguration="MyMathServiceBehavior">
            <endpoint address="MyMathService1" binding="basicHttpBinding" contract="MyMathServiceLib.IMyMathService"/>
            <endpoint address="MyMathService2" binding="basicHttpBinding" contract="MyMathServiceLib.IMyMathService"/>
            <endpoint address="MyMathService3" binding="basicHttpBinding" contract="MyMathServiceLib.IMyMathService"/>
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:9001/"/>
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="MyMathServiceBehavior">
              <serviceMetadata httpGetEnabled="True"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>

    Could you please tell weather it is an valid scenario or not. If Yes, then how can we call the service with single base address and different endpoints. 

    And for the above Config, Service is Running properly and i able to access the service with the base address "http://localhost:9001/", but when i change the address with

    base address+ endpoint address i.e. "http://localhost:9001/MyMathService1" it is not working, i am getting blank page.

    Could any one please help in this scenario.

    Regards,

    Siva.

    Tuesday, January 10, 2017 6:51 AM

All replies