Yanshof
Yanshof

Reputation: 9926

Define more one endpoint ( for more than one interfaces )

I'm new in the WCF word

I have 3 different interfaces that i want to exposed to the word.

  1. I want to define 3 endpoint - one for each interface - is it possible ?
  2. In the host - how can i create 3 different entries to those 3 exposed interface ?

Upvotes: 1

Views: 403

Answers (3)

Nima M
Nima M

Reputation: 718

Yes- You can create 3 different endpoints.

<service name ="blahblahblah">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8011/" />
      </baseAddresses>
    </host>

    <endpoint address="Stuff"
            binding="wsHttpBinding"
            contract="ICalculator" 
            " />
    <endpoint address="Stuff"
            binding="wsHttpBinding"
            contract="IEcho" 
            />
    <endpoint address="OtherEcho"
            binding="wsHttpBinding"
            contract="IOtherEcho" 
             />
   </service>

You don't need three different ports, using above example you can access your contracts on below address:

http://localhost:8011/IOtherEcho
http://localhost:8011/IEcho
http://localhost:8011/ICalculator

Upvotes: 3

Johann Blais
Johann Blais

Reputation: 9469

It is possible. Given that you create a class that implements the 3 interfaces, you can just add 3 endpoint nodes into your service in the configuration file.

Upvotes: 1

Ghyath Serhal
Ghyath Serhal

Reputation: 7632

1- Yes of course you can create an endpoint for each interface.
2- what do you mean by 3 different entries?

Upvotes: 1

Related Questions