【发布时间】:2009-02-16 13:47:58
【问题描述】:
我们在 Windows Server 2003 上托管 WCF 网络服务。该服务器只有 2 个内部 IP。我们希望将服务暴露在外部。这是通过将外部 IP 映射到服务的防火墙完成的。
因此,我需要修改服务以显示内部链接的外部 IP。这不是问题,因为它只能在外部使用。
在 IIS 中更改主机标头值会从 IIS 得到“错误请求(无效主机名)”响应。我还在 web.config 中的端点条目中添加了一个“地址”值......但它仍然只是指向内部机器名称。有什么想法吗?
编辑:我可以验证 IIS7 具有完全相同的行为。地址无效。不同的主机名给出了无效的主机名错误。真的没有办法呈现不同的(虚构的)IP吗? :/
编辑2:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicAnonymous">
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Extended">
<serviceMetadata httpGetEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</serviceBehaviors>
</behaviors>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="false" logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="true" maxMessagesToLog="3000"/>
</diagnostics>
<services>
<service behaviorConfiguration="Extended" name="AnCWCFWebService.ProductInfoProvider">
<endpoint address="" binding="basicHttpBinding" name="ASMX" bindingConfiguration="BasicAnonymous" contract="AnCWCFWebService.Interfaces.IProductInfoProvider"/>
</service>
</services>
</system.serviceModel>
【问题讨论】:
-
添加了一个我认为非常全面的全新答案。祝你好运!
-
我现在有了解决方案。让我建议您将问题的标题更改为:404 BadRequest exposing WCF service through external IP using IIS host headers。
标签: wcf iis-6 networking wcf-binding