我的雇主网站有多个主机名,它们都访问同一服务器,我们只是出于品牌目的显示不同的皮肤。
不幸的是,WCF 在这种情况下似乎不能很好地工作。
我试过了使用自定义主机工厂覆盖默认主机 http://www.robzelt.com/blog/2007/01/24/WCF+This+Collection+Already+Contains+An+Address+With+Scheme+Http.aspx.
这不是一个可接受的解决方案,因为它需要在所有主机上运行,而不仅仅是 1 个主机。
我也看过这篇博文 http://blogs.msdn.com/rampo/archive/2008/02/11/how-can-wcf-support-multiple-iis-binding-specified-per-site.aspx但要么我无法让它工作,要么它并不能解决我的问题。
我收到的错误是“该集合已经包含一个带有 http 方案的地址”
必须有一种方法来配置它,请帮忙:)
如果您没有在端点中放置地址,那么它应该解析为访问该服务的任何服务器。我使用此代码,它从 IIS 解析为我的 .local 地址和我的 .com 地址。
<system.serviceModel>
<services>
<service name="ServiceName" behaviorConfiguration="ServiceName.Service1Behavior">
<endpoint address="" binding="wsHttpBinding" contract="iServiceName">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceName.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)