Can't find net.tcp endpoint in adding a service reference in WCF?

I have a common problem with WCF binding and net.tcp. I saw that all the entries on stackoverflow are googling too ..

The main problem is that I cannot add the service link to my client. I am getting the error:

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]. 

      

  • I am using IIS 7. I checked non-HTTP.I added to website under Enable Protocols net.tcp, also added net.tcp for bindings. If I click on the address (http) my address. I can see my WCF application folder and if I select the svc file I see the usual address:

    svcutil.exe net.tcp: //MYADDRESS/Service.svc/mex

I am assuming I have installed IIS correctly if I see this url!

But the problem starts when I try to add a client link. Only I can see the http endpoints and no net.tcp.

That's my configuration in the service:

<?xml version="1.0"?>
<configuration>

      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5"/>
      </system.web>
      <system.serviceModel>
        <services>
          <service name="MYSERVICE.SERVICE" behaviorConfiguration="behavior1">
            <endpoint 
                      binding="netTcpBinding"
                      contract="MYSERVICE.ISERVICE"> 
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://localhost:60745/MYSERVICE/SERVICE/"/>
              </baseAddresses>
            </host>
          </service>
        </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="behavior1">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="netTcpBinding" scheme="net.tcp" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

      

Note: my website starts at 60745, but for net.tcp binding in IIS, I added 60746: * Also I opened outbound traffic rules for both ports.

Thank!

+3


source to share


1 answer


From the problem you mentioned in your comments, I ran it too, so the gui for Add Service Reference does not handle mexTcpBinding

very well.

You can use HTTP mex for metadata and still use net.tcp for your data feed. Here is an example from one of my projects that uses tcp feeds with http mex.



  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpConfig" closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" transferMode="Streamed"
          maxReceivedMessageSize="67108864">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="AsyncStreaming">
          <dispatcherSynchronization asynchronousSendEnabled="true"/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceCredentials>
            <serviceCertificate findValue="Example" x509FindType="FindBySubjectName"/>
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="Server.Endpoints.ExampleEndpoint">
        <endpoint address="" behaviorConfiguration="AsyncStreaming" binding="netTcpBinding" bindingConfiguration="NetTcpConfig" contract="Server.IExample"/>
        <endpoint address="" behaviorConfiguration="AsyncStreaming" binding="netTcpBinding" bindingConfiguration="NetTcpConfig" contract="Server.IExample2"/>
        <endpoint address="" behaviorConfiguration="AsyncStreaming" binding="netTcpBinding" bindingConfiguration="NetTcpConfig" contract="Server.IExample3"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <protocolMapping>
        <add binding="netTcpBinding" scheme="net.tcp" bindingConfiguration="NetTcpConfig"/>
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
    <diagnostics wmiProviderEnabled="false">
      <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"
        maxMessagesToLog="3000"/>
    </diagnostics>
  </system.serviceModel>

      

+3


source







All Articles