简介
使用 microsoft windows 安装程序 (.msi),有两种方法可以部署 xbikes 示例应用程序的 .net framework 版。本附录描述了下列部署方案
• 在单台计算机上部署 xbikes
• 在多台计算机上部署 xbikes
本附录还描述了如何配置可控制配置选项和互操作选项的各种 xml 文件。还有几部分的内容与如何执行和卸载此应用程序有关。
在单台计算机上部署 xbikes
在单台计算上使用 xbikes .net 示例代码需要安装下列软件:
• windows server 2003,或者以工作组模式运行的带有 service pack 3 或更高版本的 windows 2000 server
• .net framework 1.1(仅限 windows 2000;已包括在 windows 2003 中)
• .net framework 1.1 sdk 或 visual studio 2003
• internet 信息服务 ― www 服务器
• asp.net 应用程序服务器组件(仅限 windows 2003)
• microsoft enterprise instrumentation framework (eif)
• microsoft 消息队列(也称为 msmq)
• microsoft sql server 2000(具有混合模式安全性和 service pack 3)
• jnbridgepro 1.4 企业版(仅限于运行时)
注 asp.net 会话状态服务应在运行中,并且其启动类型应设置为自动。
安装 xbikes 应用程序
要为单台机算机上的 .net 平台安装 xbikes 应用程序,请完成下列步骤。
为 .net 平台安装 xbikes
1. 打开 windows 资源管理器,然后双击 xbikes3tier.msi。
2.在 xbikes3tier 向导页上,单击 next。
3.在 select installation folder 页面上,确保安装路径是 c:/xbikes,选中 everyone 选项以便为计算机上的所有用户安装 xbikes,然后单击 next。
4.在 confirm installation 页面上,单击 next。
5.在 install options 页面上,确保 single tier 已选中,然后单击 next。
6 在 winzip self extractor 对话框中,确保将 unzip to folder 设置为 c:/xbikes,然后单击 unzip。
7.对话框将显示文件已成功解压缩,单击 ok。
8.在 winzip self-extractor 对话框中,单击 close。
9.安装程序将用几秒钟继续设置过程。
10.在 installation complete 页面上,单击 close。
配置 xbikes web 应用程序
xbikes 应用程序现在已安装。在执行该应用程序之前,您需要将 com+ 的标识修改为网络服务,以允许应用程序在不需要他人登录的情况下执行。
配置 com+ 应用程序
1.在控制面板中,双击 administrative tools,然后双击 componentservices。组件服务管理器将进行加载。
2.在左边的树结构中,展开 component services,再展开 computers,然后展开 my computer。
3.展开 com+ applications。树视图中将显示已安装的 com+ 应用程序列表。
4.
右键单击 xbikes,然后单击 properties。屏幕上将显示 xbikes properties 对话框。
5.单击 identity 选项卡,然后单击 network service 选项。
6.单击 ok。xbikes properties 对话框将关闭。
7.关闭组件服务管理器。
现在,您已经配置了 com+ 应用程序,下一个任务是检查系统的数据库连接字符串是否正确。
配置数据库连接字符串
1. 在记事本中,从 c:/windows/system32 文件夹中打开 dllhost.exe.config 文件。
2. 查找 <sqlserver> 元素的开始标记。
3.检查以确定连接字符串包含正确的服务器名称。服务器名称在下面以粗体显示,以帮助您进行确定。
<sqlserver>
<connection>
<add
key="connectionstring"
value="server=localhost;database=xbikes;user id=dhb; password=bikes"
/>
</connection>
</sqlserver>
如果您需要更改连接字符串,请相应地修改 value 属性。
4.找到 <queuenames> 标记。更改 net-msmq 值,以包含您计算机的正确 ip 地址。
<queue>
<queuenames>
<add key="net-msmq" value="formatname:direct=tcp:192.168.0.5/private$/xbikes-orderqueue" />
5.保存 dllhost.exe.config。
6.使用记事本,从 c:/xbikes/net/xbikes-dal-msmqserviceinterface/bin/debug 文件夹中打开 xbikes-dal-msmqserviceinterface.exe.config。
7.重复步骤 2 到 4,然后保存该文件。
这样就完成了 xbikes web 应用程序的配置。
在单层上运行 xbikes
要测试安装并执行 xbikes,请完成下列步骤。
执行 xbikes
1.加载 internet explorer。
2.在 address 字段中,输入 url http://localhost/xbikes-web。
xbikes web 应用程序允许您按类型浏览自行车、定购自行车、更改数量以及检查订单。
当订单填写完后,它们将传送到消息队列。要将订单从 .net 消息队列移到 sql server 数据库中,您必须运行一个 dos 控制台应用程序。请在 .net 计算机上完成下列步骤。
运行 dos 控制台应用程序
1.打开一个命令提示。
2.键入 cd /d c:/xbikes/net/xbikes-dal-msmqserviceinterface/bin/debug,然后按回车键。
3.执行 xbikes-dal-msmqserviceinterface.exe。系统将从队列中读取一个消息,并显示订单的 xml 表示形式。
4.如果队列中的消息较多,请按 y;否则请按其他任意键以退出应用程序。
在多台计算机上部署 xbikes
本部分描述如何在分布式环境中安装 xbikes,以便将表示层、业务层和数据层安装到不同的计算机上。
另一个配置选项是在单独的计算机上设置数据库。在这种情况下,数据层连接字符串的配置设置必须正确设置为指向这台计算机。
注 在分布式设置中,内存中的适配器均不工作。这是特意设计成如此的,因为它们只有当所有三层处理在同一台计算机上运行时才能工作。对于只针对 .net framework 的设置,改为使用 .net remoting 适配器。
为每台计算机标识需求
本部分描述在安装 xbikes 应用程序之前,必须安装在分布式环境中的每台计算机上的组件。
表示层计算机设置
表示层计算机需要下列组件:
• windows server 2003,或者以工作组模式运行的带有 service pack 3 或更高版本的 windows 2000 server
• .net framework 1.1
• .net framework 1.1 sdk 或 visual studio 2003
• internet 信息服务 ― www 服务器
• asp.net 应用程序服务器组件(仅限 windows 2003)
• microsoft enterprise instrumentation framework (eif)
• jnbridgepro v1.4 企业版(仅限于运行时)
注 asp.net 会话状态服务应在运行中,并且其启动类型应设置为自动。
在表示层上安装 xbikes
要在表示层计算机上安装 xbikes,请完成下列步骤。
在表示层计算机上安装 xbikes
1.打开 windows 资源管理器,然后双击 xbikes3tier.msi。
2.在 xbikes3tier 向导页上,单击 next。
3.在 select installation folder 页面上,确保安装路径是 c:/xbikes,选中 everyone 选项以便为计算机上的所有用户安装 xbikes,然后单击 next。
4.在 confirm installation 页面上,单击 next。
5.在 install options 页面上,选择 web tier only,然后单击 next 以继续。
6. 在 winzip self extractor 对话框中,确保将 unzip to folder 设置为 c:/xbikes,然后单击 unzip。
7.在显示有多少文件已成功解压缩的对话框中,单击 ok。
8.在 winzip self-extractor 对话框中,单击 close。
安装程序将用几秒钟继续设置过程。
9.在 installation complete 页面上,单击 close。
在表示层上配置 xbikes
跨多台计算机进行部署时,xbikes web 应用程序使用 .net remoting 在各层之间进行通讯。在执行该应用程序之前,您必须将 .net remoting 的配置更改为指向正确的计算机。
在表示层上配置 .net remoting
• 使用记事本,从 c:/xbikes/net/xbikes-web 文件夹中打开 remoting.config。
• 查找 <wellknown> 元素,然后将其 url 属性设置为 .net remoting 业务层服务界面的 url。您必须将服务器名称设置为安装有业务层组件的计算机的名称,如下例所示。
<wellknown
url="http://businesstiercomputer/xbikes-bll-remotingserviceinterface/bllremotingserviceinterface.rem"
type="xbikes.bll.serviceinterface.net.remoting.bllremotingserviceinterface, xbikes-bll-remotings
闽公网安备 35060202000074号