WCF service with both basicHttpBinding and netTcpBinding; can't access HTTP endpoint

Pascal picture Pascal · Dec 10, 2010 · Viewed 9.8k times · Source

I want to make available the same interface with a netTcpBinding and basicHttpBinding. I also wanna make available the wsdl for both endpoints. When I access http://localhost:9876/TestService/, I get the mex endpoint that has the information for the Tcp endoint at http://localhost:9876/TestService/?wsdl, but the address http://localhost:9876/TestService/ws does not respond, and I can't understand why. I have the base address, and the relative address. Can someone lend me a hand pointing out what's missing? Right now, I'm just trying to get working the TestImplementation service, and I haven't messed with the MessaginImplementation service.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="SimpleBinding" />
            </basicHttpBinding>
            <netTcpBinding>
                <binding name="DefaultTCPBinding" transactionFlow="true" />
            </netTcpBinding>
        </bindings>
        <behaviors>
            <serviceBehaviors>
                <behavior name="MetadataBehavior">
                    <serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding"
                        httpGetBindingConfiguration="" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service behaviorConfiguration="MetadataBehavior" name="CompanyX.AppServer.Implementation.TestImplementation">
                <endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
                    name="TestTCPEndpoint" contract="CompanyX.AppServer.Interfaces.ITest" />
                <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
                    name="TestMex" contract="IMetadataExchange" />
                <endpoint address="/ws" binding="basicHttpBinding" bindingConfiguration="SimpleBinding"
                    name="Test" contract="CompanyX.AppServer.Interfaces.ITest" />
                <host>
                    <baseAddresses>
                        <add baseAddress="net.tcp://localhost:9878/TestService" />
                        <add baseAddress="http://localhost:9876/TestService/" />
                    </baseAddresses>
                </host>
            </service>
            <service behaviorConfiguration="MetadataBehavior" name="CompanyX.AppServer.Implementation.MessaginImplementation">
                <endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
                    name="MessagingTCPEndpoint" contract="CompanyX.AppServer.Interfaces.IMessaging" />
                <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
                    name="MessagingMex" contract="CompanyX.AppServer.Interfaces.IMessaging" />
                <host>
                    <baseAddresses>
                        <add baseAddress="net.tcp://localhost:9878/MessagingService" />
                        <add baseAddress="http://localhost:9876/MessagingService" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>
</configuration>

Answer

Pascal picture Pascal · Dec 11, 2010

It's a rookie mistake on my part. It's actually correct. The answer is in the post below. I only get a response from the browser when I hit the base HTTP class, but using this wsdl, I can connect with both bindings.