配置支持Fluorine Remoting的Web应用

来源:互联网 发布:大连淘宝 编辑:程序博客网 时间:2024/06/05 06:38

安装Fluorine Visual Studio Wizard

配置支持Fluorine的.Net Web应用最简单的方式安装Fluorine模板,该模板目前只支持Visual C# 和Visual Basic,可以从http://fluorine.thesilentgroup.com/fluorine/download.html下载。安装时采用默认的就行了。安装路径下的文件夹如下图所示。

使用Fluorine模板配置Web应用

这里以Visual Studio 2005(非速成版)为例。在安装有Fluorine模板的Visual Web Developer中, 选择Fluorine ASP.NET Web application Template 模板。再设置好网站的位置,这里本地路径。接下来设置一种网站的语言,这里选择Visual C#。如下图所示。

单击确定就创建了一个支持Fluorine 的Web应用。在Visual Web Developer 中打开解决方案资源管器,我们将看到整个工程的结构。如下图。

与用ASP.NET模板生成的普通网站相比多出的文件在上图已经标明。其中com.TheSilentGroup.Fluorine.dll、Gateway.aspx和web.config是必不可少的。

由此可见,用Fluorine模板配置支持Flash Remoting和Flex 2 Remoting的Web应用是很方便的。

手动配置 Flash Remoting的Web应用

如果我们的IDE不支持Fluorine模板,要想创建Fluorine Flash Remoting的Flash Web应用,就不得不手动添加它们。下面以Visual Studio 2005速成版为例介绍其详细步骤。

  1. 使用ASP.NET模板生成一个普通的网站。
  2. 选择工程文件,单击右键选择添加引用.NET> Fluorine,单击确定,将com.TheSilentGroup.Fluorine.dll和log4net.dll添加到Bin文件夹中。
  3. 新增Web.config文件,将下述代码添加到<system.web>节点中。这样我们就将Fluorine服务器组件以模块的方式添加到Web应用中了。
<httpModules> <add name="FluorineGateway"  type="com.TheSilentGroup.Fluorine.FluorineGateway,com.TheSilentGroup.Fluorine" /></httpModules>
  1. 新增Gateway.aspx,它是一个空白的Web窗体, 网关会指向它。

好了,一个支持AMF0的Web应用就配置好了

手动配置支持Flex2 Remoting的Web应用

前面的配置只适用于Flash平台,如果要适用于Flex 2平台,要能支持AMF3,还得添加Flex 2 Remoting服务配置文件。具体步骤如下:

  1. 在Web应用根目录/WEB-INF/flex下添加services-config.xml文件。
  2. 打开services-config.xml,添加如下代码。
<?xml version="1.0" encoding="UTF-8"?><services-config>      <services>           <service id="remoting-service"                   class="flex.messaging.services.RemotingService"                   messageTypes="flex.messaging.messages.RemotingMessage">              <destination id="fluorine">                  <channels>                       <channel ref="my-amf"/>                  </channels>                   <properties>                       <source> *</source>                   </properties>               </destination>           </service>       </services> <security> <login-command class="com.TheSilentGroup.Fluorine.Messaging.Security.GenericLoginCommand" server="asp.net"/></security> <channels>           <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"><endpoint uri=http://{server.name}:{server.port}/{context.root}/Gateway.aspx class="flex.messaging.endpoints.AMFEndpoint"/>          </channel-definition></channels> </services-config>

好了,一个支持Flash Remoting(AMF0)又支持Flex2 Remoting(AMF3)的Web应用就配置好了。

建议

指定端口ASP.NET Development Server 。默认下该Web应用使用的是动态端口中,为便于讲述,请设置使用动态端口的属性为false,端口号为8088。这样使用http://localhost:8088/flashservices/Gateway.aspx就可以指向网关URL了。

建议你配置远程服务浏览器,这样可以方便开发。还有就是设置日志,这样可以方便测试维护。具体细节就不详谈了。

 

有了Fluorine 做.net 和flash的交互太方便了 :-)

 
原创粉丝点击