0

I have an existing Windows service (so no IIS) which hosts a WCF-service.

At this moment it is listening one address: http://xxx/service.svc.

And now I want it to ALSO listen to a second address: http://yyy/service.svc.

I can only modify the configuration, not the sources. The service is running under .NET Framework 4.5.2.

My configuration:

    <services>
        <service behaviorConfiguration="All" name="MyNamespace.MyService">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="myBindingConfig" contract="MyNamespace.IMyService"/>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            <host>
                <baseAddresses>
                    <add baseAddress="http://xxx/service.svc"/>
                </baseAddresses>
            </host>
        </service>
    </services>

What I have tried so far:

  • Added an extra base address. Then I get an exception: This collection already contains an address with scheme http.
  • Duplicated the service-element and modify the base address. Exception: A child element named 'service' with same key already exists at the same configuration scope.
  • If I change the name of both services: Service 'MyNamespace.MyService' has zero application (non-infrastructure) endpoints.
  • If have read about and tried serviceHostingEnvironment (as suggested in WCF service startup error "This collection already contains an address with scheme http") but only adding that snippet in, does not help. Maybe that is a half step forward, but then I need the second half of that solution.
Martin Mulder
  • 12,642
  • 3
  • 25
  • 54
  • Maybe [this post](https://stackoverflow.com/questions/3434216/wcf-listen-base-address-anyip) would give you some help. – Jiayao Oct 04 '21 at 03:26
  • [The msdn sample](https://learn.microsoft.com/en-us/dotnet/framework/wcf/samples/multiple-endpoints-at-a-single-listenuri) demonstrates a service that hosts multiple endpoints at a single ListenUri. – Jiayao Oct 19 '21 at 12:52

0 Answers0