.net BasicHttpsBinding 和具有传输安全性的 WsHttpBinding 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14874529/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 16:52:47  来源:igfitidea点击:

What is the difference between BasicHttpsBinding and WsHttpBinding with Transport security?

.netwshttpbinding

提问by dqm

As BasicHttpsBinding is new at .net 4.5, I don't seem to be able to find much stuff around differences between the two.

由于 BasicHttpsBinding 在 .net 4.5 中是新的,我似乎无法找到关于两者之间差异的很多东西。

回答by Philippe

Indeed the two bindings are very similar. The only real difference is that to require HTTPS, the endpoint needed to be configured with a BasicHttpBinding in which you define the security mode as Transport (or any of the other valid enumerations). With a BasicHttpsBinding on the endpoint, the security mode is defaulted to Transport and the client credential type is set to None.

事实上,这两个绑定非常相似。唯一真正的区别是需要 HTTPS,需要使用 BasicHttpBinding 配置端点,您可以在其中将安全模式定义为传输(或任何其他有效枚举)。在端点上使用 BasicHttpsBinding 时,安全模式默认为 Transport,客户端凭据类型设置为 None。

So here was your configuration before WCF 4.5:

所以这是你在 WCF 4.5 之前的配置:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="Service.BasicHttp.BindingConfig">
        <security mode="Transport" />        
      </binding>
    </basicHttpBinding>
  </bindings>
  <services>
    <service name="ServiceImpl">
      <endpoint address="" binding="basicHttpBinding" bindingConfiguration="Service.BasicHttp.BindingConfig"
                name="IService.Http" contract="IService">
      </endpoint>
    </service>
  </services>
</system.serviceModel>

With WCF 4.5, the same configuration can be simplified to:

使用 WCF 4.5,相同的配置可以简化为:

<system.serviceModel>
  <services>
    <service name="ServiceImpl">
      <endpoint address="" binding="basicHttpsBinding" name="IService.Http" contract="IService">
  </endpoint>
</service>
  </services>
</system.serviceModel>

See What's new in WCF 4.5? BasicHttpsBindingfor additional detail.

请参阅WCF 4.5 中的新增功能?BasicHttpsBinding了解更多详细信息。