WCF wsDualHttpBinding 绑定

发布时间:2020-06-28 17:12:59 作者:rmlifejun
来源:网络 阅读:654
服务端配置文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <appSettings>
    <add key="secretKey" value="!@#$aIMeILIfe2014SysTem%^*" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

  <!--LOG日志 2014-10-15 BY 翁乔-->
  <log4net>
    <logger name="MPLIFE">
      <level value="ALL" />
    </logger>
    <logger name="logerror">
      <level value="ERROR" />
      <appender-ref ref="ErrorAppender" />
    </logger>
    <logger name="loginfo">
      <level value="INFO" />
      <appender-ref ref="InfoAppender" />
    </logger>
    <logger name="logtrace">
      <level value="INFO" />
      <appender-ref ref="TraceAppender" />
    </logger>
    <!--调试日志-->
    <appender name="InfoAppender" type="log4net.Appender.RollingFileAppender">
      <param name="File" value="Log\\Info\\" />
      <param name="AppendToFile" value="true" />
      <param name="StaticLogFileName" value="false" />
      <param name="DatePattern" value="yyyyMMdd&quot;.log&quot;" />
      <param name="RollingStyle" value="Date" />
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%n信息时间:%d%n信息内容:%m%n" />
      </layout>
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    </appender>
    <!--错误日志-->
    <appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
      <param name="File" value="Log\\Error\\" />
      <param name="AppendToFile" value="true" />
      <param name="StaticLogFileName" value="false" />
      <param name="DatePattern" value="yyyyMMdd&quot;.log&quot;" />
      <param name="RollingStyle" value="Date" />
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%n异常时间:%d%n异常内容:%m%n" />
      </layout>
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    </appender>
    <!--跟踪日志-->
    <appender name="TraceAppender" type="log4net.Appender.TraceAppender">
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%m" />
      </layout>
    </appender>
  </log4net>

  <system.serviceModel>
    <services>
      <service name="Suppot.Servies.SuppotServies">
        <endpoint binding="wsDualHttpBinding" bindingConfiguration="SuppotServicesBinding" behaviorConfiguration="SuppotBehavior" contract="Suppot.Servies.ISuppotServies">
        </endpoint>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="SuppotBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点 -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsDualHttpBinding>
        <binding name="SuppotServicesBinding" receiveTimeout="00:03:00" sendTimeout="00:03:00" maxReceivedMessageSize="2147483647" transactionFlow="True">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None" />
        </binding>
      </wsDualHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <directoryBrowse enabled="true" />
  </system.webServer>

</configuration>

客户端配置:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IAccount" />
        <binding name="BasicHttpBinding_IBaseService" />
      </basicHttpBinding>
      <wsDualHttpBinding>
        <binding name="WSDualHttpBinding_ISuppotServies" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="false" transactionFlow="true" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text"
          textEncoding="utf-8" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" />
          <security mode="None">
            <message clientCredentialType="Windows" negotiateServiceCredential="true" />
          </security>
        </binding>
      </wsDualHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://****/Sys/Account.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAccount"
        contract="Account.IAccount" name="BasicHttpBinding_IAccount" />
      <endpoint address="http://****/baseinfo/BaseService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBaseService"
        contract="BaseService.IBaseService" name="BasicHttpBinding_IBaseService" />
      <endpoint address="http://****/SuppotServies.svc"
        binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_ISuppotServies"
        contract="SuppotServies.ISuppotServies" name="WSDualHttpBinding_ISuppotServies" />
    </client>
  </system.serviceModel>
</configuration>

推荐阅读:
  1. wcf的wcfdualHTTPBinding的调用严重慢的问题
  2. WCF简单教程(6) 单向与双向通讯

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

配置文件 服务端 wcf 配置

上一篇:javascript中闭包的应用场景

下一篇:关于C#构造方法的分析

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》