WCF 使用 Https 绑定数据(包括分布式WCF事务配置方法)

今天客户上线,到了生产环境,才知道客户用的是https 协议,吼吼,麻烦来了。搞了半晚上,从凌晨1点,。。。。。。。

总结一下,有以下几个地方需要注意:

1.启用https协议,需要用域名绑定地址(证书授权给这个域名),比如:如果你访问一个https网站,如果IE提醒你,该网站有危险是否继续,如果用域名访问就不会有这个提醒

2.需要有身份认证方式<security mode="Transport">  

3.服务端的行为 <serviceMetadata httpsGetEnabled="true"/>

具体如下:web的

<binding name="WSHttpsCommonBinding" closeTimeout="00:30:00"
          openTimeout="00:30:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="65000" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
          allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" />
          <security mode="Transport">  
            <transport clientCredentialType="None" proxyCredentialType="None"  
                realm="" />  
            <message clientCredentialType="UserName" algorithmSuite="Default" />  
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

<endpoint address="https://www.uuuu.cn/b.svc"
        behaviorConfiguration="BigListDataBindingBehavior" binding="wsHttpBinding"
        bindingConfiguration="WSHttpsCommonBinding"
        contract="AssignFunctionServiceRef.IAssignFunctionService" name="WSHttpBinding_IAssignFunctionService" />

服务端:

 <behavior name="CommonBehavior">
	<serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>

<binding name="NewBinding" closeTimeout="00:30:00"
          openTimeout="00:30:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="65000" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
          allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" />
          <security mode="Transport">  
            <transport clientCredentialType="None" proxyCredentialType="None"  
                realm="" />  
            <message clientCredentialType="UserName" algorithmSuite="Default" />  
          </security>
        </binding>


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值