Asp.net與Flex互動測試記錄

來源:互聯網
上載者:User

標籤:des   http   使用   檔案   資料   os   

一、利用asp.net為Flex提供資料服務,flex為前端表現。 
二、flex通過三種方式四種代碼實現來取資料。分別為 
    HttpService、 
WebService、 
RemoteObject、 
RemoteObjectAMF0。 
三、Project檔案夾中的 
Vs2010Service提供HttpService、Webservice服務; 
        Vs2008RemoteObject提供RemoteObject服務。 
四、FluorineFx.NET+RemoteObjectAMF0檔案為附加檔案。 
五、<sessionState cookieless="AutoDetect"></sessionState> 
設定可相容用戶端禁用Cookie(要在Flex項目中傳遞迴sessionid) 
六、asmx中使用session需要[WebMethod(EnableSession = true)] 如此設定。 

七、安裝FluorineFx.NET+RemoteObjectAMF0檔案下的setup(FluorineFx.NET).exe 
可以將項目樣板集成到2005和2008中,不支援vs2010。 
八、使用七中的模板建立普通網站(FluorineFx ASP.NET Web Site)項目。 
將Console.aspx設為啟動頁,可進行類中的方法測試。 
九、使用RemoteObjectAMF0時將renaun_com_RemoteObjectAMF0.zip解壓把src下的 
com檔案夾整體複製到flex項目中; 
注意路徑與mxml同路徑; 
RemoteObjectAMF0.as中的override public function setCredentials( username:String, password:String):void)修改成override public function setCredentials( username:String, password:String,charset:String=null ):void) 
添加xmlns:renaun="com.renaun.rpc.*"到<mx:Application ……中。 
十、使用普通RemoteObject在mxml的同目錄下添加services_config.xml檔案內容如下: 

Xml代碼  
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2.         <services-config>  
  3.             <services>  
  4.                 <service id="remoting-service"  
  5.                         class="flex.messaging.services.RemotingService"  
  6.                         messageTypes="flex.messaging.messages.RemotingMessage">  
  7.                     <destination id="fluorine">  
  8.                         <channels>  
  9.                             <channel ref="my-amf"/>  
  10.                         </channels>  
  11.                         <properties>  
  12.                             <source>*</source>  
  13.                         </properties>  
  14.                     </destination>  
  15.                 </service>  
  16.             </services>  
  17.             <channels>  
  18.                 <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">  
  19.                  <endpoint uri="http://localhost:12432/ReomteFlex/Gateway.aspx" class="flex.messaging.endpoints.AMFEndpoint"/>  
  20.                 </channel-definition>  
  21.             </channels>  
  22.         </services-config>  


註:http://localhost:12432/ReomteFlex/Gateway.aspx隨項目啟動的連接埠變化。 

之後,Flex項目右鍵-屬性-Flex compiler-compiler參數(-locale en_US -services "services_config.xml") 

十一、以上功能使用的前提 
運行vs2008項目、vs2010項目、Flex項目; 
vs2008項目、vs2010項目啟動後的連接埠與本執行個體建立時的連接埠不一致,請將變化後的連接埠相應改變Flex項目中即可。 
十二、Flex項目HttpService方式中的URL地址中有一個{sessionid}可以不要,只是為了測試而以,就安vs預設將sessionid放在Cookie即可。 
十三、整個流程為: 
輸入使用者名稱:njm 
密碼:168 
登入成功返回當前sessionid 
之後可點擊“帶著身份訪問”進行測試。 
最後點擊“退出”。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.