Separating out WCF Configuration Into Multiple Files with configSource

本文介绍如何使用configSource属性将Windows Communication Foundation (WCF)配置文件拆分为更小、更易于管理的部分。通过这种方法可以显著提高大型项目的可维护性。

WCF configuration files can sometimes be very, very long. And there’s a good reason for that too: WCF makes heavy use of configuration so that you can do just about anything you can do with code in a config file. I recently decided to estimate how much of the entire framework’s configuration belongs to WCF by looking at what percentage of the framework’s schema is under system.serviceModel, system.runtime.serialization, and system.serviceModel.activation. It turns out those section groups alone account for more than 70% of the entire framework’s configuration schema.

 

So even more so than for other section groups, it’s useful to be able to break up a long WCF configuration file into smaller, more manageable files. You can do this using the “configSource” attribute. It allows you to reference another file that contains the configuration section you declared.

 

So instead of having the following in your App.config:

 

<configuration>

  <system.serviceModel>

    <services>

      <servicename="Service.EchoService"behaviorConfiguration="EchoServiceBehavior">

        <endpointaddress =""binding="basicHttpBinding"contract="Service.IEcho"/>

        <endpointaddress="mex"binding="mexHttpBinding"contract="IMetadataExchange"/>

      </service>

    </services>

    <behaviors>

      <serviceBehaviors>

        <behaviorname="EchoServiceBehavior">

          <serviceMetadatahttpGetEnabled="True" />

          <serviceDebugincludeExceptionDetailInFaults="True" />

        </behavior>

      </serviceBehaviors>

    </behaviors>

  </system.serviceModel>

</configuration>

 

You could have the following in your App.config:

 

<configuration>

  <system.serviceModel>

    <services>

      <servicename="Service.EchoService"behaviorConfiguration="EchoServiceBehavior">

        <endpointaddress =""binding="basicHttpBinding"contract="Service.IEcho"/>

        <endpointaddress="mex"binding="mexHttpBinding"contract="IMetadataExchange"/>

      </service>

    </services>

    <behaviorsconfigSource="behaviors.config" />

  </system.serviceModel>

</configuration>

 

And this in behaviors.config:

 

<behaviors>

  <serviceBehaviors>

    <behaviorname="EchoServiceBehavior">

      <serviceMetadatahttpGetEnabled="True" />

      <serviceDebugincludeExceptionDetailInFaults="True" />

    </behavior>

  </serviceBehaviors>

</behaviors>

 

If you wanted you could separate out your entire system.serviceModel section group into smaller files:

 

<configuration>

  <system.serviceModel>

    <servicesconfigSource="services.config"/>

    <bindingsconfigSource="bindings.config"/>

    <behaviorsconfigSource="behaviors.config"/>

    <extensionsconfigSource="extensions.config"/>

  </system.serviceModel>

</configuration>

 

Note, however, that you can only use this for sections. This technique can’t be used for the system.serviceModel section group or for any config elements. Also note that the referenced files should contain only one section, and that you won’t need a <configuration> or <system.serviceModel> tag in them, just the section being referenced.

 

Referenced from: http://blogs.msdn.com/b/youssefm/archive/2009/11/03/separating-out-wcf-configuration-into-multiple-files-with-configsource.aspx

打开链接下载源码: https://pan.quark.cn/s/331a85e1b463 在数字化时代背景下,软件授权与保护显得极为关键,微狗(MicroDog)作为一款硬件加密狗,其主要功能是保障软件的合法使用,避免盗版和未经授权的访问。为了达成这一目的,微狗驱动发挥着不可或缺的作用。驱动程序充当硬件与操作系统之间的沟通纽带,确保两者能够和谐协作。现阶段,64位微狗驱动(UMI64位)已经兼容Windows 11、Windows 10以及Windows 7操作系统,为不同的系统环境提供坚实可靠的支持。 随着Windows操作系统的持续升级,对驱动程序的兼容性需求也在逐步提高。微狗驱动UMI64位版本正是为了应对兼容性问题而研发的。它不仅适配最新版的Windows 11,同时也与过去几年中普遍应用的Windows 10和Windows 7保持兼容。如此全面的系统支持,使得微狗加密狗能够在多种环境中稳定运作,确保软件授权管理不受操作系统版本的限制。 在这个驱动中,特别强调了支持UMI V4.1版本。UMI可能代表Unique Machine Identifier,即用于标识特定硬件设备的唯一序列号。提及UMI V4.1表明该驱动能够精准识别并支援微狗加密狗的此特定型号。同时,这也暗示驱动可能与其他版本的微狗硬件兼容,这意味着用户可以在不同版本的微狗加密狗之间切换而不必频繁更换驱动程序。 UMI64位标签凸显了驱动程序的核心特征,即它专为64位系统进行优化。相较于32位系统,64位系统在处理海量数据、运行大型应用时展现出显著优势,例如能够支持更大的内存地址空间。随着软件复杂性的提升,对硬件资源的需求持续增长,因此64位系统能够提供更优越的性能和稳定性。UMI系列硬件与...
代码下载地址: https://pan.quark.cn/s/a4b39357ea24 ### Xilinx Vivado硬件诊断:ILA与VIO的应用指南 #### 一、背景信息 在FPGA的设计阶段,硬件诊断和验证工作占据着至关重要的地位。根据相关数据统计,在一个典型的FPGA开发流程中,硬件诊断和验证所占用的开发周期比例通常在30%到40%之间。因此,精通FPGA设计工具的调试功能对于提升开发效率具有显著作用。 #### 二、ILA与VIO的功能说明 ##### 1. ILA (Integrated Logic Analyzer) ILA是Xilinx公司提供的一种用于监测FPGA内部信号的逻辑分析仪工具。该工具能够捕获并保存FPGA内部信号波形,从而为开发者提供调试支持。ILA的核心结构如图1所示: **图1 ILA Core** ILA的主要构成部分包括时钟输入端、探针输入端口以及用于存储采样数据的BRAM(Block RAM)。设计人员可以通过配置ILA核来指定探针的总数、采样深度以及每个探针的位宽。此外,ILA还支持通过JTAG接口与外部调试设备进行通信。 - **探针输入端口**:用于连接FPGA内部信号线路。 - **采样深度**:决定了能够存储的样本数量。 - **探针位宽**:指定了每个探针可以监控的信号位数。 - **通信机制**:通过JTAG接口与调试核心集线器实现交互。 ##### 2. VIO (Virtual Input/Output core) VIO是一种能够实时监控和驱动FPGA内部信号的内核。与ILA的不同之处在于,VIO无需额外的片上或片外存储器来保存数据。 - **信号类型**: - **Input Probes**:...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值