wcf - BasicHttpBinding 端点配置中的 bindingConfiguration 属性是什么?

标签 wcf

所以我正在为 WCF 服务配置端点。我几乎没有整体服务的经验,但是在使用它们的项目中间被扑倒了。我大致了解端点中的每个属性都在做什么,除了一个。 “绑定(bind)配置”。

这是我的代码的模糊版本(实际信息是专有的):

      <endpoint address="http://localhost/SomeService.svc"
           binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISomeService"
           contract="SomeService.ICoreService" name="BasicHttpBinding_ISomeService" />

这是 MSDN 对此的看法(因为他们没有专门解决它)。

Microsoft's incomplete MSDN Entry

当然 Stackoverflow 有一些问题包含“bindingConfiguration”的字符串匹配,但没有一个明确解决我的问题:

Most relative (I think) Stackoverflow question

关于它的用途有什么想法吗?

为了学习,我愿意在这里试一试,犯错。我认为它与身份验证或安全性有关。在检查接口(interface)时,我也没有注意到与此相关的任何内容。

任何帮助都会很棒!

干杯

马特

最佳答案

在您的绑定(bind)部分中,您可以为同一绑定(bind)类型(在您的情况下为 basicHttpBinding)拥有多个“配置”。绑定(bind)配置在其中选择使用哪一个。

在 MSDN 中,您应该尝试查找 <endpoint> 的引用。 (因为 bindingConfiguration 是属性),这将定义属性应该做什么。

在下面的示例中,服务定义了两个端点,都使用 basicHttpBinding .其中一个通过“普通”HTTP 公开,另一个通过 HTTPS 公开。 bindingconfiguration属性是告诉 WCF 使用哪种配置的属性。

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="SimpleBasic">
                <security mode="None"/>
            </binding>
            <binding name="BasicOverHttps">
                <security mode="Transport"/>
            </binding>
        </basicHttpBinding>
    </bindings>
    <services>
        <service name="MyNamespace.MyService">
            <endpoint address="ep"
                      binding="basicHttpBinding"
                      bindingConfiguration="SimpleBasic"
                      contract="MyNamespace.IService" />
            <endpoint address="secure"
                      binding="basicHttpBinding"
                      bindingConfiguration="BasicOverHttps"
                      contract="MyNamespace.IService" />
        </service>
    </services>
</system.serviceModel>

关于wcf - BasicHttpBinding 端点配置中的 bindingConfiguration 属性是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7043814/

相关文章:

wcf - 如何删除 ServiceHost 持有的大对象堆上的 Byte[]

c# - WCF/LINQ to SQL 中的序列化

wcf - 为什么我的WCF端点不抛出Max Clock Skew异常?

WCF 错误仅使用 wsHttpBinding 发送到 SOAP 1.1 时 SOAP 1.2 消息无效

c# - 如何为我的应用程序显示 "Windows Firewall has blocked some features of this program"对话框?

c# - Windows Azure VM 上的 WCF wsdualhttpbinding 绑定(bind)

c# - 以编程方式让客户端应用程序使用 URL 列出在运行时创建的 WCF 服务端点(如 WCF 测试客户端所做的那样)

c# - 通过 SSL 问题的 Silverlight 3/WCF 通信

c# - 不显示堆栈跟踪的 wcf 异常

asp.net - WCF 错误 - 意外响应 : (400) Bad Request