WCF配置文件

导读:本篇文章讲解 WCF配置文件,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

最近项目使用wcf技术开发,觉得应该将配置文件记录下来:

服务器端配置

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="MyServiceBehavior" name="Database.OracleDatabaseService">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="binding" contract="Database.IDatabaseService"/>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:16015/Service/Database"/>
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="MyServiceBehavior" name="Machine.DownloadService">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="binding" contract="Machine.IDownloadService"/>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:16016/Service/Download"/>
          </baseAddresses>
        </host>
      </service>
    </services>       

    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          <serviceMetadata/>
          <serviceDebug includeExceptionDetailInFaults="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <netTcpBinding>
        <binding name="binding" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" 
                 maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
          <security mode="None">
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

客户端配置文件

<?xml version="1.0" encoding="utf-8" ?>
<configuration>  
  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="ServiceBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
    </behaviors>

    <bindings>
      <netTcpBinding>
        <binding name="ServiceBinding" sendTimeout="00:03:00" maxBufferPoolSize="2147483647" 
                                       maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>

    <client>
      <endpoint address="net.tcp://localhost:16015/Service/Database" name="Database" binding="netTcpBinding" 
                                bindingConfiguration="ServiceBinding" contract="Ehl.ATMOS.TCS.JR.DB.DbBusiness.IDatabaseService" />

      <endpoint address="net.tcp://localhost:16016/Service/Download" name="Download" binding="netTcpBinding" 
                                bindingConfiguration="ServiceBinding"  contract="Ehl.ATMOS.TCS.JR.InteracteOper.ServiceClients.IDownloadService"  />
    </client>
  </system.serviceModel>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>  
</configuration>

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/14814.html

(0)
小半的头像小半

相关推荐

极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!