Enterprise WCF - Integrate WCF Configuration into Your Enterprise Framework

本文探讨了在企业级分布式软件开发中使用WCF时面临的配置管理挑战,并介绍了一种将WCF服务配置集成到企业框架的方法。

Background

Lots of people declares they are using WCF in their “enterprise” distributed software development together with other SOA technologies, and even calls their software architecture WCF based. If you are one of them, could you please answer the questions below; or, if you plan to be one of them, ask yourself the questions below:

  • How many WCF services are their in your enterprise architecture?
  • How many sub-systems and databases?
  • How many servers deploying or consuming WCF services?
  • How many load-balanced server farms and application tiers related to WCF?
  • How many deployment server environments (DEV, QA, Staging, Production, etc)?
  • Are your servers and farms in different domains, with different connectivity and different network bandwidth?
  • What are your auto-build, test and release processes for WCF services?
  • How do you deal with the WCF service configuration difference for different deployment server environments?
  • How often are your WCF service configuration changed?
  • How do you maintain your WCF service configuration changes?
  • Where are your WCF service configuration saved?

The goal to ask the questions above is to lead you thinking & agree:

  • The management of WCF services in enterprise distributed software development is not an easy stuff.
  • To put WCF service configuration in your application configuration files is a nightmare for enterprise distributed software development.
  • For enterprise distributed software development involving WCF service, an “enterprise framework” integrating consistent centralized WCF service configuration management is highly necessary.

Let me give a definition for “enterprise framework” discussed in this text: a set of shared software development components, and related configuration persistence and development & management process for all the distributed application development in enterprise.

Give you an example of “enterprise framework” in my company, even before using WCF, we already have a set of shared software components (VJ++/VB/DotNet COM DLLs for Non-DotNet applications; and DotNet DLLs for all DotNet applications), and a centralized database based configuration store for all the application app settings, connection strings, Web Service URLs and dependency injected object factory. We also have related development, maintain and release process for both the software components and the data in the configuration store.

Since you agree (I assumes) about the “the goal to ask the questions” above, when beginning to widely use WCF in our enterprise application development, you could imagine, we try to integrate WCF service configuration into our enterprise framework.

Articles I posted before already shows the possibility to centralize and programmatically configure all WCF service configuration. The rest of this text will introduce the summary of how we integrate WCF service configuration into our enterprise framework, and show you how to easily integrate WCF service configuration into other frameworks on the top of NIntegrate – an open source DotNet integration framework.

How We Integrate WCF Configuration into Our Enterprise Framework

I don’t want to expose any confidential information of my company, the purpose of this chapter is only to show you the benefits we get from the solution and give you more confidence to adopt a similar solution.

  • Since we put all the configuration for applications in centralized database even before using WCF, the most suitable place to save all WCF configuration is the same database. And because our existing configuration are grouped by servers, load-balanced server farms and different applications, when extending the database to support WCF configuration, we easily get the ability to reuse WCF configuration at application, server or even farm scope for contracts, addresses, bindings, behaviors, security, etc.
  • Since we put all the configuration in database instead of application configuration files, our applications could have very light application configuration files, and even no application files. This makes the auto-build & deployment of our application on different deployment server environment be super easy - no code change required for release packages on different server environments.
  • To read configuration from database for publishing & consuming WCF services, we created some shared components (DotNet components only) to our development framework library, including custom ServiceHost Factory for hosting services and custom ChannelFactory for consuming services. For non-DotNet applications, they could also consume WCF services through Web Service binding or through DotNet COM wrappers (for windows apps only).
  • The shared components not only read & cache WCF configuration from database, but also automatically refresh the cache in memory through background threads according to specified refresh policy, so it is easy to change WCF configuration at runtime, ex., disable/enable services or endpoints, change bindings, addresses or other settings, apply consistent health monitor, performance trace, error handling & logging, etc, through custom behaviors or other extension APIs of WCF.

Integrate WCF Configuration into a Dummy Enterprise Framework on the Top of NIntegrate

To demonstrate how to integrate WCF configuration into an enterprise framework, I’ll introduce a dummy enterprise framework in this chapter.

The attached picture is the class diagram of dummy enterprise framework integrated with NIntegrate:

ClassDiagram

Before integrated with NIntegrate, all the classes and methods containing the word ‘Wcf’ does not exist. The Dummy framework provides abilities to create class instances dependency injected, and get application variables & connection strings centrally, which are very common functions an enterprise framework may provide.

To use the DummyFramework, easily call DummyFrameworkConfigurationManager.GetConfiguration() to get an instance of DummyFrameworkConfiguration, and use it to construct a DummyFramework instance. Then you can call methods on DummyFramework.

On the top of NIntegrate, we could easily give the WCF configuration & custom persistence ability to the dummy framework.

To consume a WCF service, call the CreateWcfChannel<T>() method on DummyFramework, inside which reads WCF client endpoint configuration from DummyFrameworkConfiguration, which internally could load the configuration from anywhere rather than only in application configuration file (The returning instance is WcfClientEndpoint class, which is a serializable WCF DataContract defined in NIntegrate). The CreateWcfChannel<T>() method calls WcfChannelFactoryFactory.CreateChannelFactory<TChannel>() method, which is defined in NIntegrate, creates the ChannelFactory, cache it and returns an instance of WcfChannelWrapper class (also defined in NIntegrate), which implements the best practice for disposing a WCF channel instance.

Sample code as below:

    var df = new DummyFramework(DummyFrameworkConfiguationManager.GetConfiguration());
using (var wrapper = df.CreateWcfChannel<IDummyService>())
{
Response.Write(wrapper.Channel.SayHello());
}

To publish a WcfService, create the DummyWcfServiceHostFactory class, and set the Factory property of a .svc file as below:

<%@ ServiceHost Service="DummyEnterpriseService.Implementation.DummyService"
Factory="DummyEnterpriseFramework.DummyWcfServiceHostFactory" %>

The DummyWcfServiceHostFactory class inherits the WcfServiceHostFactory class defined in NIntegrate, and overrides the LoadServiceConfiguration() method to load configuration from anywhere expected (The returning instance is WcfService class, which is a serializable Wcf DataContract defined in NIntegrate).

Attached the source code of the sample DummyEnterpriseFrameworkIntegration:

DummyEnterpriseFrameworkIntegration.zip


Original by Teddy's Knowledge Base, All rights reserved.

First Publish: http://www.cnblogs.com/teddyma/archive/2009/08/28/1556076.html


//The end

内容概要:本文详细记录了对一个Android ARM64静态ELF文件中字符串加密机制的逆向分析过程。该ELF文件的所有字符串均被加密,无法通过常规strings命令或IDA直接识别。作者通过分析发现,加密字符串存储在.rodata段,其解密所需信息(包括密文地址、长度和16位密钥)保存在.data.rel.ro段的40字节描述符中。核心解密函数sub_10F408采用自反的双pass流密码算法,结合固定密钥KEY_TERM(由.data段24字节数据计算得出),实现字节级非线性、位置与长度相关的加密。文章还复现了完整的Python解密脚本,并揭示了该保护机制的本质为代码混淆而非强加密,最终成功批量解密全部956条字符串,暴露程序真实行为,如shell命令模板、设备标识篡改、网络重置等操作。此外,文中还提及未启用的自定义壳框架及其反dump设计。; 适合人群:具备逆向工程基础的安全研究人员、二进制分析人员及对ELF保护技术感兴趣的开发者。; 使用场景及目标:①学习ELF二进制中字符串加密的典型实现方式与逆向突破口;②掌握从结构识别、函数追踪到算法还原的完整逆向流程;③理解“绑定二进制”的完整性校验设计及其局限性;④实践编写IDAPython脚本自动化提取与解密敏感数据。; 阅读建议:此资源以实战案例驱动,不仅展示技术细节,更强调逆向思维与验证方法,建议读者结合IDA调试环境,逐步跟随文中步骤进行动态分析与算法验证,深入理解每一步的推理依据。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值