WCF issue to work with netTcpBinding

Below is my app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="Indexer">
        <endpoint address="net.tcp://localhost:8000/Indexer/" binding="netTcpBinding"
          bindingConfiguration="TransactionalTCP" contract="Me.IIndexer" />
      </service>
      <service name = "Indexer" behaviorConfiguration = "MEXGET">
        <host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8000/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name = "MEXGET">
          <serviceMetadata httpGetEnabled = "true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="TransactionalTCP"
           transactionFlow="true"
         />
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

      

For some reason, I cannot get to the WCF service on the machine where I run it. Can anyone spot the error? I have a netTcpBinding service.

When I had the same working in HTTP it worked fine with the following .config file

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="IndexerServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8080/Indexer/"/>
          <serviceDebug includeExceptionDetailInFaults="True" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="Indexer" behaviorConfiguration="IndexerServiceBehavior">
        <endpoint address="http://localhost:8080/Indexer/" binding="basicHttpBinding"
            bindingConfiguration="" name="HTTP" contract="IIndexer" />
        <endpoint address="http://localhost:8080/Indexer/MEX/" binding="mexHttpBinding"
            bindingConfiguration="" name="MEX" contract="IMetadataExchange" />
      </service>
    </services>
  </system.serviceModel>
</configuration>

      

I cannot figure out what I am doing wrong.

+2


source to share


3 answers


Surely you opened the firewall so it would listen?

If this is used, here is a binding I used successfully not too long ago:



<services>

  <service name="MyService.MySearch" behaviorConfiguration="ServiceBehavior">
    <host>
      <baseAddresses>
        <add baseAddress="http://mypc:8003/MyService"/>
      </baseAddresses>
    </host>
    <endpoint bindingConfiguration="Binding1"
              binding="netTcpBinding"
              contract="MyService.IMySearch"
              address="net.tcp://mypc:8004/MyService"  />
  </service>
</services>
<bindings>
  <netTcpBinding>
    <binding name="Binding1"
             hostNameComparisonMode="StrongWildcard"
             sendTimeout="00:10:00"
             maxReceivedMessageSize="65536"
             transferMode="Buffered"
             portSharingEnabled="false">
      <security mode="None">
        <transport clientCredentialType="None" />
        <message clientCredentialType="None" />
      </security>
    </binding>
  </netTcpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
    </behavior>
  </serviceBehaviors>
</behaviors>

      

There is no security in this binding.

+3


source


You may need to Enable Net.TCP Port Exchange Service . Quoting from MSDN:

Windows Communication Foundation (WCF) uses a Windows service called Net.TCP Port Exchange to facilitate TCP port sharing across multiple processes. This service is installed as part of WCF, but the service is not enabled by default as a precaution and therefore must be manually enabled prior to first use. This section describes how to configure a TCP / TCP Network Sharing service that uses the Microsoft Management Console (MMC).



Good luck!

+1


source


Try using different port numbers for http and net.tcp bindings. Port sharing has a different purpose, to share the same net.tcp port among multiple processes.

0


source







All Articles