1

I am hosting a wcf rest service within a windows service hosting container and am having an issue mapping http requests from a distinct dns name to a given wcf endpoint. It seems like the requests are mapped via IP Address and the dns name is being ignored. I have been researching if it is possible to add a "host header" for a given http wcf endpoint when hosted as a windows service. I know this is the mechanism IIS employs to distinctly map multiple web site dns names to distinct websites using a single IP Address. Is this same mapping mechanism or something similar to it available for a wcf http endpoint hosted as a windows service?

For example if I have two endpoints configured on the same port:

<system.serviceModel>
    <services>
        <service name="RequestInstanceService">
            <endpoint address="http://dns1.mydomain.com/requestinstanceservice" binding="webHttpBinding"   contract="MyService.IRequestInstanceService" >
            </endpoint>
        </service>
        <service name="CentralKeyingAuthorityService">
            <endpoint address="http://dns2.mydomain.com/ckaservice" binding="webHttpBinding"  contract="MyService.ICentralKeyingAuthorityService" >
            </endpoint>
        </service>          
    </services>
    <behaviors>
        <endpointBehaviors>
            <behavior>
                <webHttp />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <bindings />
</system.serviceModel>

I would like to be able to distinctly map requests from dns1.mydomain.com to the requestinstanceservice and requests from dns2.mydomain.com to the ckaservice. If hosted in IIS, my assumption is that I would be able to set a host header for dns1.mydomain.com and dns2.mydomain.com to direct request to the appropriate website (wcf host).

Since I am hosting these wcf services within a windows service host the behavior seems a bit different. It appears like the dns component is irrelevant since I can reach the requestinstanceservice endpoint by using either dns name:

http://dns1.mydomain.com/requestinstanceservice or http://dns2.mydomain.com/requestinstanceservice

Can someone help me understand how to make the mapping distinct so that the dns name is taken into account in the mapping?

Doug
  • 5,268
  • 24
  • 31

0 Answers0