开发者

Define more one endpoint ( for more than one interfaces )

开发者 https://www.devze.com 2023-02-10 18:44 出处:网络
I\'m new in the WCF word I have 3 different interfaces that i want to exposed to the word. I want to defin开发者_开发百科e 3 endpoint - one for each interface - is it possible ?

I'm new in the WCF word

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

  1. I want to defin开发者_开发百科e 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 ?


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


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


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.

0

精彩评论

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