关于WCF 安全连接配置 说明

26 篇文章 0 订阅
6 篇文章 0 订阅

客户端配置:

核心配置:web.config

  <system.serviceModel>
    <bindings>
      <ws2007HttpBinding>
        <binding name="WS2007HttpBinding_ICenterDynamicService"  maxReceivedMessageSize="2147483647" >
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"  maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="01:01:00"  enabled="false" />
          <security mode="Message">
            <transport clientCredentialType="Windows" />
            <message clientCredentialType="Windows" />

          </security>
        </binding>
      </ws2007HttpBinding>
    </bindings>
    <client>
      <endpoint address="http://wechaxxxxxx/Services/AcxxxxynamicSexe.svc"
        binding="ws2007HttpBinding" bindingConfiguration="WS2007HttpBinding_ICenterDynamicService"
        contract="DBCenterDynamicService.ICenterDynamicService" name="WS2007HttpBinding_ICenterDynamicService">
        <identity>
          <servicePrincipalName value="host/Mexxxatapp" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>


其中:

交互数据量比较大的情况,下采用如下配置,详情网络搜索

          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"  maxNameTableCharCount="2147483647" />


交互通讯报错,请添加如下连跳配置:

         <reliableSession ordered="true" inactivityTimeout="01:01:00"  enabled="false" />


安全模式:

          <security mode="Message">




服务器端配置: web.config  核心配置


<system.serviceModel>
    <bindings>
      <ws2007HttpBinding>
         
<binding openTimeout="23:00:00"  receiveTimeout="23:00:00" sendTimeout ="23:00:00"   maxReceivedMessageSize='2147483647'   >
          <readerQuotas maxDepth='2147483647'

                        maxStringContentLength='2147483647'
                         maxArrayLength='2147483647'
                         maxBytesPerRead='2147483647'
                         maxNameTableCharCount='2147483647'/>

          </binding>  
      </ws2007HttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
        <behavior  name="useWindowsGroupsAuthorization">

          <serviceAuthorization principalPermissionMode="UseWindowsGroups"/>
          <serviceMetadata httpGetEnabled="true" />
        </behavior>

      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

    <services>

      <service name="DBServices.Services.Activity.CenterDynamicService" behaviorConfiguration="useWindowsGroupsAuthorization">
        <endpoint address="" binding="ws2007HttpBinding" contract="DBServices.Services.Activity.ICenterDynamicService"/>
      </service>
    </services>

    
  </system.serviceModel>


解决交互数据量比较大的问题:

<binding openTimeout="23:00:00"  receiveTimeout="23:00:00" sendTimeout ="23:00:00"   maxReceivedMessageSize='2147483647'   >
          <readerQuotas maxDepth='2147483647'

                        maxStringContentLength='2147483647'
                         maxArrayLength='2147483647'
                         maxBytesPerRead='2147483647'
                         maxNameTableCharCount='2147483647'/>


其中:  receiveTimeout="23:00:00"  描述长连接超时时长,与客户端 inactivityTimeout 配套使用, inactivityTimeout <  receiveTimeout

安全连接配置:

..........
        <behavior  name="useWindowsGroupsAuthorization">
          <serviceAuthorization principalPermissionMode="UseWindowsGroups"/>
          <serviceMetadata httpGetEnabled="true" />
        </behavior>

..........

    <services>
      <service name="DBServices.Services.Activity.CenterDynamicService" behaviorConfiguration="useWindowsGroupsAuthorization">
        <endpoint address="" binding="ws2007HttpBinding" contract="DBServices.Services.Activity.ICenterDynamicService"/>
      </service>
    </services>



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值