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