我的雇主网站有多个主机名,都是同一个服务器,我们只是显示不同的皮肤来进行品牌宣传.
不幸的是,在这种情况下,WCF似乎不能很好地工作.
我试过overriding the default host with a custom host factory.
这不是一个可以接受的解决方案,因为它需要从所有主机工作,而不仅仅是1.
我也看过this blog post,但是我无法让它工作,或者不是为了解决我的问题.
我得到的错误是“这个集合已经包含一个地址与方案http”
有一个配置方法,请帮忙:)
解决方法
如果您不在终端中放置地址,那么它应该解析为任何服务器访问该服务.我使用这个代码,它解决了我的.local地址和我的.com地址从IIS.
@H_301_18@<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>