Remotec
Remotec

Reputation: 10772

WCF Endpoints Configuration

Going through the "Whats new in WCF4.0" tutorial. The 1st exercise is to set up a service without any config. Then you put some configuration in place to provide service meta data. Simple stuff.

What I have now tried to do is to expand the config to expose the same service contract on a different port - in this case http://localhost:9001/test

This is my config ...

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="WCF4Configuration.EchoServiceBehavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="WCF4Configuration.EchoServiceBehavior" name="WCF4Configuration.EchoService">
            <endpoint address="" binding="wsHttpBinding" contract="WCF4Configuration.IEchoService">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>                              
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          <endpoint address="http://localhost:9001/test" binding="wsHttpBinding" contract="WCF4Configuration.IEchoService"/>
        </service>
    </services>
</system.serviceModel>

However I try to connect to this I get the message that the machine actively refused the connection. Why doesn't this work? And what address can I use in wcftestclient to show the service?

Upvotes: 1

Views: 6696

Answers (1)

Nix
Nix

Reputation: 58602

Try:

<services>
        <service behaviorConfiguration="WCF4Configuration.EchoServiceBehavior" name="WCF4Configuration.EchoService">
            <endpoint address="" binding="wsHttpBinding" contract="WCF4Configuration.IEchoService">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>                              
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          <endpoint address="" binding="wsHttpBinding" contract="WCF4Configuration.IEchoService">
           <host>
            <baseAddresses>
              <add baseAddress="http://localhost:9001/test/" />
            </baseAddresses> 
          </endpoint>
        </service>
</services>

Upvotes: 0

Related Questions