FluorineFx对于现有站点的配置

step 1:
新建一个FluorineFX网站,作为参考

step 2:
在现有网站添加FluorineFX网站的相关dll引用,并拷贝console.aspx和gateway.aspx至网站根目录(最好是在现有网站下重新建立这两个空白页面,然后拷贝代码过去,这样可以避免一些编译问题)

step 3:
修改web.config,在httpModules下添加节点
<add name="FluorineGateway" type="FluorineFx.FluorineGateway, FluorineFx" />

step 4:
打开console.aspx,看是否报错,如果不报错,开始添加FluorineFX类库

step 5:
网站添加FluorineFX类库的引用

step 5:
新建Flex项目,这里最好是将项目建立在网站目录下,因为需要的services-config.xml文件的路径是相对于mxml文件而言的;当然也可以采用绝对路径,类似"e:\MyFile\WEB-INF\FLEX\services-config.xml"这样,但在发布到正式服务器,你就得重新更改路径,所以还是采用相对路径比较好

然后设置Web application root与Web application URL,这里也要考虑到以后的发布,所以建议在本地建立一个和服务器对应网站一样的本地路径,然后以未来的域名为标准修改本地hosts文件,这样来分别设置这两个值,就做到了本地调试,发布到远程也不需要再修改这2个参数

然后设置Output folder,设置为网站的flash存放目录

这一步做完,你的网站目录大致是这样的

MySolution(解决方案)
 --ServiceLibrary1(FluorineFX类库)
  Sample.cs
 --WEB(网站目录)
  Console.aspx
  Gateway.aspx
  --FlashPage(存放flash文件的路径,下面列出的是发布需要的文件,源文件也在该目录)
   <!-- 发布需要的文件 -->
   AC_OETags.js
   FlexSource.swf
   FlexSource.html
   playerProductInstall.swf
   --WEB-INF
    --Flex
     services-config.xml
     remoting-config.xml
     services-config.xml
     services-config.xml
   --history
     ……
   <!-- 源文件 --> 
   .project
   .flexProperties
   ……
   --src
    FlexSource.mxml
   

step 6:
设置Flex项目属性Flex Compiler:

在-locale en_US后面加上-services "../services-config.xml"
这里的路径是相对于当前MXML的路径

step 7:
设置Flex项目属性Flex Server(出错才配置):

如果调试出错,错误信息类似:
faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost:4110/as/Gateway.aspx'"

那么代表Gateway.aspx这个目录没有正确对应,这个时候要检查Context root的配置是否正确

step 8:
编写测试程序
.net代码:

using System;
using System.Collections.Generic;
using System.Text;
using FluorineFx;
namespace ServiceLibrary8
{
    [RemotingService(
"Fluorine UserInfo service"
)]
    
public class
 UserInfo
    {
        
public
string GetString(string name, int age)
        {
            
return
 name + 
" is "
 + age + 
" years old"
;
        }
    }
}

flex代码:

<mx:Application xmlns:mx=
"http://www.adobe.com/2006/mxml"
 layout=
"absolute"
>
 <mx:Button x=
"212"
 y=
"126"
 label=
"Button"
 click=
"onClick()"
 />
 <mx:Label id=
"lblResult"
 x=
"225"
 y=
"77"
 text=
"Label"
/>
 <mx:RemoteObject id=
"myRemote"
 destination=
"fluorine"
 source=
"ServiceLibrary8.UserInfo"
 result=
"onResult(event)"
>
  <mx:method name=
"GetString"
>
  </mx:method>
 </mx:RemoteObject>
 <mx:Script>
  <![CDATA[
   
import
mx.rpc.events.ResultEvent;
   
private function
 onClick():
void
   {
    
this
.myRemote.GetString(
"胡青牛"
,35);
   }
   
   
private function
 onResult(event:ResultEvent):
void
   {
    
this
.lblResult.text = event.result.toString();
   }
  ]]>
 </mx:Script>
</mx:Application>
原文地址:https://www.cnblogs.com/CoderWayne/p/1777896.html