zoukankan      html  css  js  c++  java
  • 如何配置不启用安全的WCF服务?(转载)

    【1】问题描述:
    一般WCF默认很多绑定是使用安全的,一般不是Transport(TcpBinding)就是Message(WSHttpBinding)安全模式。
    而且会对客户端启用身份验证。 因为WCF安全设置与开发比较麻烦,所以大部分开发人员希望不启用安全模式。 那么如何做呢?


    【2】参考配置:
    服务端首先可以设置SecurityMode=“None”。这个可以通过配置文件,也可以通过代码来实现。这里给出配置文件的方式。参考代码:


        <wsHttpBinding>
          <binding
    name="bindingConfiguration">
            <security mode="None">

              <transport clientCredentialType="None"/>
       <message
    clientCredentialType="None"/>
            </security>
         
    </binding>
        </wsHttpBinding>


    另外这里还要把这个绑定用到对应的Endpoint的配置上:


    bindingConfiguration="bindingConfiguration"


    例子如下:


            <endpoint
              address="WCFService"
             
    binding="wsHttpBinding"
             
    bindingConfiguration="bindingConfiguration"
             
    contract="WCFService.IWCFService">
            </endpoint>


    【3】Client配置: 客户端配置 也要与之对应,最好重新添加服务引用。更新客户端配置。 当然也可以自己手动更新,因为没有使用安全传输以及验证客户端。
    所以客户端简化配置如下:


        <system.serviceModel>
            <bindings>
               
    <wsHttpBinding>
                    <binding
    name="WSHttpBinding_IWCFService" />
                        <security
    mode="None">
                            <transport
    clientCredentialType="None" />
                            <message
    clientCredentialType="None"  />
                        </security>

                    </binding>
                </wsHttpBinding>

            </bindings>
            <client>
               
    <endpoint address="https://frank-xu2009:9001/WCFService"
    binding="wsHttpBinding"
                   
    bindingConfiguration="WSHttpBinding_IWCFService"
    contract="ClientProxy.IWCFService"
                   
    name="WSHttpBinding_IWCFService" />
            </client>
       
    </system.serviceModel>

  • 相关阅读:
    openLDAP 2
    OPEN LDAP
    ORA-00604: 递归 SQL 级别 1 出现错误 ORA-01000: 超出打开游标的最大数
    linux常用命令
    EMC存储同时分配空间到两台服务器路径不一致-双机盘符不一致
    新年SO交期更新——FP_SO2SAP
    表有主外键约束时的delete 方法 2008
    mix_alternates_for_parent: TRUE
    javaweb:关于HttpServletRequest介绍 (转)
    Tomcat 调优的技巧 (转)
  • 原文地址:https://www.cnblogs.com/sojastudio/p/2697157.html
Copyright © 2011-2022 走看看