简体   繁体   中英

Is it possible to create an other endpoint in HTTP on the same port?

One of my mate has created a C# WCF service working on Net.TCP on a specific port, it is asked to me if it is possible to create an other endpoint on this WCF service in order to consume it with HTTP protocol on the same port?

How can I do to consume a WCF service with two differents protocols Net.TCP + HTTP?

Thanks per advance for your answers:)

Edit: Do you have an example about how to implement a HTTP + Net.TCP endpoints in a WCF service?

As far as I know, this is completely impossible. But service could work properly over Net.TCP+Http over different port number.

<services>
      <service  name="ConsoleApp3.TestService">
        <endpoint address="" binding="netTcpBinding" contract="ConsoleApp3.ITestService" ></endpoint>
        <endpoint address="http" binding="basicHttpBinding" contract="ConsoleApp3.ITestService"></endpoint>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"></endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:21012"/>
            <add baseAddress="http://localhost:21013"/>
          </baseAddresses>
        </host>
      </service>
</services>

Net.TCP Port sharing only is applicable for the scenario that has different service addresses, not the indeed port sharing.
Feel free to let me know if there is anything I can help with.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM