Auto-resolving a hostname in WCF Metadata Publishing

前端 未结 1 1045
死守一世寂寞
死守一世寂寞 2021-01-21 16:08

I am running a self-hosted WCF service. In the service configuration, I am using localhost in my BaseAddresses that I hook my endpoints to. When trying to con

相关标签:
1条回答
  • What .NET version are you using? If you're using .NET 4.0, add the UseRequestHeadersForMetadataAddressBehavior to your service host:

    UseRequestHeadersForMetadataAddressBehavior urh = 
        new UseRequestHeadersForMetadataAddressBehavior();
    serviceHost.Description.Behaviors.Add(urh);
    

    Obviously, this needs to be done prior to opening the service host.

    If you're using .NET 3.5, there's a hotfix that adds this behavior: support.microsoft.com/kb/971842.

    0 讨论(0)
提交回复
热议问题