现在的位置: 首页 > 综合 > 正文

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

2013年02月20日 ⁄ 综合 ⁄ 共 2282字 ⁄ 字号 评论关闭

今天客户上线,到了生产环境,才知道客户用的是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>

抱歉!评论已关闭.