Duwamish deployment scenarios articles

Duwamish deployment scenarios articles

Duwamish 7.0 supports two types of multi-computer deployment scenarios. Non-distributed deployment scenarios deployed on a Web host Web layer, business appearance, business rules and data access layers, but you can copy the Web host in order to achieve load balancing across the cluster. Program specific components distributed deployment on a separate server. For example, the appearance of business, business rules and data access layer may be located on independent Web host server. In an actual deployment database server is typically located on a separate computer.

1, non-distributed deployment scenarios

Deployed on a Web host Web layer, business appearance, business rules and data access layer, then load balancing within the network field (Web Farm) by each Web Server software (such as Application Center 2000) or hardware.

In the machine a default installation Duwamish 7.0, is to use non-distributed deployment.

  

2, distributed deployment scenarios

Use the .NET Framework remoting technology applications will be distributed to multiple computers. In simple terms, it is the IIS Web Server and Application Server separation, in which the Web layer (including SystemFramework and Common project) is deployed on IIS Web, BusinessFacde / BusinessRules / DataAccess layer (including SystemFramework and Common project) deployed on Application Server together.

 

 

Duwamish 7.0 using HTTP / binary rather than HTTP / SOAP. Use HTTP-based decisions through the firewall on port 80 requirements. We decided to use a binary SOAP-based rather than performance considerations. For the large block of data, the performance is better than binary SOAP. Therefore, to pass large block of data (e.g., an array, a data set or data table), using the binary formatter. If the transfer smaller data block is selected using the SOAP or binary formatter it is irrelevant. Both are very good performance when passing an integer.

3, 如何将Duwamish 7.0部署为基于.Net Remoting的分布式系统

下面采用Microsoft提供的Deploytool工具自动进行(其实手工也很方便):

C:\Program Files\Microsoft Visual Studio .NET 2003\Enterprise Samples\Duwamish 7.0 CS>deploytool deploy RemoteMachine=localhost path="C:\Program Files\Microsoft Visual Studio .NET 2003\Enterprise Samples\Duwamish 7.0 CS\Duwamish7_Remote" 

在command line窗口输入上述命令行代码。

[10/29/2004 6:43:43 AM] Creating directory C:\Program Files\Microsoft Visual Studio .NET 2003\Enterprise Samples\Duwamish 7.0 CS\Duwamish7_Remote on W1MIS38

[10/29/2004 6:43:43 AM] Stopping all internet services on W1MIS38

[10/29/2004 6:43:59 AM] Deploying Duwamish7 Business Facade on W1MIS38

[10/29/2004 6:43:59 AM] Creating web site on W1MIS38

[10/29/2004 6:44:00 AM] Generating remoting configuration files

[10/29/2004 6:44:00 AM] Starting all internet services on W1MIS38

[10/29/2004 6:44:02 AM] Starting Default Web Site on W1MIS38

[10/29/2004 6:44:02 AM] Deployment successful

运行结果:

(1)在IIS创建中创建Web Application(Duwamish7_Facade),本地路径为:C:\Program Files\Microsoft Visual Studio .NET 2003\Enterprise Samples\Duwamish 7.0 CS\Duwamish7_Remote\web 作为Remote Server端,Bin目录下是BusinessFacde/BusinessRules/DataAccess层(包括SystemFramework和Common项目)DLL文件。

其中web.config文件中包含所有Remote Objects的配置,如

<wellknown mode="Singleton" type="Duwamish7.BusinessFacade.ProductSystem, Duwamish7.BusinessFacade" objectUri="ProductSystem.rem" />

(2)Web层创建remotingclient.cfg配置文件,对Application Server而言,Web层相当与Client端。

remotingclient.cfg配置文件中包含formatter的设置(binary ),选择二进制格式化程序来序列化消息,注意是出于性能的考虑。

(3)Web application加载remotingclient.cfg配置文件

Web application在global.asax文件包括如下代码,在Application_OnStart事件中加载Retmoting配置文件。

void Application_OnStart()

{

ApplicationConfiguration.OnApplicationStart(Context.Server.MapPath( Context.Request.ApplicationPath ));

string configPath = Path.Combine(Context.Server.MapPath( Context.Request.ApplicationPath ),"remotingclient.cfg");

if(File.Exists(configPath))

    RemotingConfiguration.Configure(configPath);

}

其中前面代码ApplicationConfiguration.OnApplicationStart()是调用Duwamish7.SystemFramework.ApplicaitonConfiguration的OnApplicationStart()方法,用来初始化application root和读取web.config中的配置信息(将在Duwamish代码分析篇》中进行具体分析)。

18:00  |  固定链接 | 引用通告 (0) | 记录它 | Duwamish
Duwamish架构分析篇

Duwamish是Microsoft提供一个企业级的分布式系统架构,如果开发企业级的分布式系统,可以模仿这种架构,如果是开发一些简单的系统,则完全可以简化。

 

以前也学习过Duwamish范例,只是发现不同时间,不同经历,有不同的体会。正如卢彦所说的一样:通过研究Duwamish示例,高手能够领悟到.Net应用架构的设计思想,低手能够学习到.Net的编程技巧,实在是老少皆宜。

 

因此,这里再次学习并体验一次Duwamish范例。

 

1Duwamish 7.0 结构分为四个逻辑层(FROM MSDN):

Web 层 - Presentation

Web 层为客户端提供对应用程序的访问。这一层是作为 Duwamish.sln 解决方案文件中的 Web 项目实现的。Web 层由 ASP.NET Web 窗体和代码隐藏文件组成。Web 窗体只是用 HTML 提供用户操作,而代码隐藏文件实现各种控件的事件处理。

业务外观层 - Business Facade

业务外观层为 Web 层提供处理帐户、类别浏览和购书的界面。这一层是作为 Duwamish.sln 解决方案文件中的 BusinessFacade 项目实现的。业务外观层用作隔离层,它将用户界面与各种业务功能的实现隔离开来。除了低级系统和支持功能之外,对数据库服务器的所有调用都是通过此程序集进行的。

业务规则层 - Business Rules

业务规则层是作为 Duwamish.sln 解决方案文件中的 BusinessRules 项目实现的,它包含各种业务规则和逻辑的实现。业务规则完成如客户帐户和书籍订单的验证这样的任务。

数据访问层 - Data Access

数据访问层为业务规则层提供数据服务。这一层是作为 Duwamish.sln 解决方案文件中的 DataAccess 项目实现的。

 

除了上述四个逻辑层外,Duwamish 7.0 还包含封装在 Duwamish.sln 解决方案文件中的 Common 项目内的共享函数。“通用”(Common) 层包含用于在各层间传递信息的数据集。Common 项目还包含 Duwamish.sln 解决方案文件中的 SystemFramework 项目内的应用程序配置和跟踪类。

 

2,各个逻辑层之间的关系图(FROM MSDN)及其调用Sequeance图示例:
Duwamish_Architecture.gif

下面是Categories.aspx web页面获取Category的Description的整个调用过程。

(1)实例化ProductSystem对象

(2)调用ProductSystem的GetCategories()方法

(3)检测参数的合法性

(4)创建Categories::DataAccess对象实例

(5)返回上述对象

(6)调用Categories::DataAccess对象的GetCategories()方法

(7)创建CategoryData::Common对象实例

(8)返回上述对象

(9)返回CategoryData::Common对象实例,该实例中已经包含了需要的数据

(10)返回CategoryData::Common对象实例给web/Client端

(11)检测数据的合法性

(12)读取并显示结果:Category的Description


Duwamish_SequenceDiagram.gif

SystemFramework项目包含一些application需要的配置参数,ApplicationLog日志类和ApplicationAssert参数校验类。SystemFramework项目为所有其他的项目所引用。

 

Common项目包含了用于在各层间传递信息的数据集,如上述的CategoryData继承System.Data.DataSet,既不是所谓的typed DataSet,也不是一般的DataSet,不过简单实用,这是基于.Net Remoting开发分布式系统用来tier与tier之间交互数据的一种方法。Common项目也被其他的项目引用,SystemFramework项目除外。

 

BusinessFacade项目中所有的Classes继承MarshalByRefObject class,显然是让准备将BusinessFacade tier部署为Remote Objects。不过,实际上默认这里并没有将其部署为Remote Objects,Web层仍然调用本地对象(《Duwamish部署方案篇》将分析这个问题)。

 

3Summary

 

在开发基于.Net Framework企业级分布式系统时,上述架构值得推荐,但也并非完美无暇,实际上存在一些值得改进的地方。显然,不可能一个范例适合所有的实际情况么,要求太苛刻了。其实,Enterprise Samples中的另外一个范例Fitch and Mather 7.0,其架构和Duwamish就有些不同了。

 

如果是开发本地的系统,就不要模仿Duwamish架构(看看上面获取Category的Description调用过程就知道了,太费劲。),如Business Facade和Business Rules中Classes应采用fine-grained interface设计,层与层之间的交互参数也不必全部采用DataSet,适当的时候采用setter/getter就可以了,这样不仅可以提高开发效率,而且有助于提高performance, maintainability and reusability。

转载于:https://www.cnblogs.com/Spring/archive/2006/06/10/422553.html

Guess you like

Origin blog.csdn.net/weixin_34290390/article/details/93932424