我有一个有一个http端点的WCF服务, 我想添加另一个具有不同绑定的http端点地址。 该服务不在IIS中托管,因此设置了multipleSiteBindingsEnabled 是没用的。
我正在尝试这样的事情。
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service behaviorConfiguration="ServiceBehaviorConfiguration"
name="ServerService">
<endpoint address="http://localhost:6732/ServerService" binding="webHttpBinding" behaviorConfiguration="webby"
contract="IClientAppContract">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:800/ServerService" binding="basicHttpBinding"
contract="IClientAppContract">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:800/ServerService" />
<add baseAddress="http://localhost:6732/ServerService" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
答案 0 :(得分:0)
尝试类似下面显示的配置。它通过单端口公开多个端点,但我确信WCF支持这种配置模式。
<services>
<service behaviorConfiguration="ServiceBehaviorConfiguration"
name="ServerService">
<endpoint address=""
binding="webHttpBinding"
behaviorConfiguration="webby"
contract="IClientAppContract">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="basic"
binding="basicHttpBinding"
contract="IClientAppContract">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:800/ServerService" />
</baseAddresses>
</host>
</service>
</services>
答案 1 :(得分:0)
您可以创建两个服务,每个服务都有自己不同的baseAddress,但它们的内部端点是相同的。