在 BasicHttpBinding 端点配置中负责的 bindingConfiguration 属性是什么? [英] What is the bindingConfiguration attribute responsible for in a BasicHttpBinding endpoint config?
问题描述
所以我正在为 WCF 服务配置端点.我对整个服务几乎没有经验,但在使用它们的项目中遇到了麻烦.我大致了解端点中的每个属性除了一个属性在做什么.绑定配置".
So I am working with configuring endpoints for a WCF service. I have almost no experience with services as a whole, but have been plopped in the middle of a project that uses them. I roughly understand what each attribute in the endpoint is doing except for one. "bindingConfiguration".
这是我的代码的模糊版本(实际信息是专有的):
Here's an obscured version of my code (actual information is proprietary):
<endpoint address="http://localhost/SomeService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISomeService"
contract="SomeService.ICoreService" name="BasicHttpBinding_ISomeService" />
这是 MSDN 对此的看法(因为他们没有专门解决这个问题).
Here's MSDN's take on it (as in they don't specifically address it).
当然,Stackoverflow 有几个问题包含bindingConfiguration"的字符串匹配,但没有一个明确解决我的问题:
Of course Stackoverflow has a few questions containing a string match for "bindingConfiguration" but none explicetely address my question:
对它的用途有什么想法吗?
Any ideas on what this is used for?
为了学习的兴趣,我愿意在这里试一试并犯错.我认为它与身份验证或安全性有关.在检查接口时,我也没有注意到与此相关的任何内容.
In the interest of learning I am willing to take a stab and be wrong here. I think it has something to with authentication or security. On Inspection of the Interface I notice nothing pertaining to this either.
任何帮助都会很棒!
干杯
马特
推荐答案
在您的绑定部分,您可以为相同的绑定类型(在您的情况下,basicHttpBinding)有多个配置".绑定配置从中选择使用哪一个.
In your bindings section, you can have multiple "configurations" for the same binding type (in your case, basicHttpBinding). The binding configuration chooses among them which one to use.
在 MSDN 中,您应该尝试找到 < 的参考.端点>
(因为 bindingConfiguration 是属性),它将定义该属性应该做什么.
In MSDN, you should try to find the reference for <endpoint>
(since bindingConfiguration is is attribute), that will have a definition of what the attribute is supposed to do.
在下面的示例中,服务定义了两个端点,均使用 basicHttpBinding
.其中一个通过普通"HTTP 公开,另一个通过 HTTPS 公开.bindingconfiguration
属性是告诉 WCF 使用哪种配置的属性.
In the example below, the service defines two endpoints, both using basicHttpBinding
. One of them is exposed over "normal" HTTP, the other is exposed over HTTPS. The bindingconfiguration
attribute is the one which tells WCF which configuration to use.
<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>
这篇关于在 BasicHttpBinding 端点配置中负责的 bindingConfiguration 属性是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!