客户端配置:
核心配置: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>