c# – WCF和多个主机头
发布时间:2020-12-15 17:35:48 所属栏目:百科 来源:网络整理
导读:我的雇主网站有多个主机名,都是同一个服务器,我们只是显示不同的皮肤来进行品牌宣传. 不幸的是,在这种情况下,WCF似乎不能很好地工作. 我试过overriding the default host with a custom host factory. 这不是一个可以接受的解决方案,因为它需要从所有主机工
我的雇主网站有多个主机名,都是同一个服务器,我们只是显示不同的皮肤来进行品牌宣传.
不幸的是,在这种情况下,WCF似乎不能很好地工作. 我试过overriding the default host with a custom host factory. 这不是一个可以接受的解决方案,因为它需要从所有主机工作,而不仅仅是1. 我也看过this blog post,但是我无法让它工作,或者不是为了解决我的问题. 我得到的错误是“这个集合已经包含一个地址与方案http” 有一个配置方法,请帮忙:) 解决方法
如果您不在终端中放置地址,那么它应该解析为任何服务器访问该服务.我使用这个代码,它解决了我的.local地址和我的.com地址从IIS.
<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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读