如何保护webHttpBinding? [英] How to secure webHttpBinding?

查看:88
本文介绍了如何保护webHttpBinding?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的WCF服务中,我试图通过SSL连接使用JSON将数据发送到客户端.我可以使用wsHttpBindingTransport的安全模式将OData数据库源保护到我的客户端.为什么webHttpBinding不能为了使用SSL而做同样的事情?如何配置需要使用JSON才能使用SSL连接的端点?

In my WCF service I am trying to to send data to the client using JSON over an SSL connection. I was able to secure the OData database source to my client using wsHttpBinding with a security mode of Transport. Why is webHttpBinding not able to do the same in order to use SSL? How would I configure an endpoint that needs to use JSON to use an SSL connection as well?

基本上webHttpBindingwsHttpBinding有什么区别?

Essentially what is the difference between webHttpBinding and wsHttpBinding?

<bindings>
  <wsHttpBinding>
    <binding name="TransportSecurity">
      <security mode="Transport">
        <transport clientCredentialType="None" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>

  <endpointBehaviors>
    <behavior name="EndpBehavior">
      <webHttp />
    </behavior>
  </endpointBehaviors>
</behaviors>

<services>
  <service behaviorConfiguration="ServiceBehavior" name="DataService4.DataService">

    <endpoint address="" binding="webHttpBinding" contract="DataService4.IService" bindingConfiguration="TransportSecurity" behaviorConfiguration="EndpBehavior" />

    <endpoint contract="IMetadataExchange" binding="mexHttpsBinding" address="mex" />   
  </service>
</services>

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

推荐答案

我认为本文将解决您的问题. 创建WCF RESTful服务并确保安全它通过SSL使用HTTPS

I think this article will solve your problem. Creating a WCF RESTful Service And Secure It Using HTTPS Over SSL

这篇关于如何保护webHttpBinding?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆