2013-06-05 62 views
0

我有以上WCF的Web get方法執行兩次

[OperationContract] 
    [WebGet(UriTemplate = "/Get_Flights/{partnerCode}/{from_airport_code}/{to_airport_code}/{date_from}/{date_to}/{round_trip}/{direct_flight}/{adults}/{kidA}/{kids}/{infants}/{airline_code}/{service_class}/{includeWebFares}/{includeServiceFee}/{LangId}", 
     RequestFormat = WebMessageFormat.Json, 
     ResponseFormat = WebMessageFormat.Json)] 
    List<List<Dictionary<string, object>>> Get_Flights(string partnerCode, 
     string from_airport_code, 
     string to_airport_code, 
     string date_from, 
     string date_to, string round_trip, string direct_flight, 
     string adults, string kidA, string kids, string infants, 
     string airline_code, string service_class, string includeWebFares, string includeServiceFee, string LangId); 

和上述

public List<List<Dictionary<string, object>>> Get_Flights(string partnerCode, 
     string from_airport_code, 
     string to_airport_code, 
     string date_from, 
     string date_to, string round_trip, string direct_flight, 
     string adults, string kidA, string kids, string infants, string airline_code, 
     string service_class,string includeWebFares, string includeServiceFee,string LangId) 
    { //get data from webservice} 

對於我不能爲一個呼叫的公共方法運行兩次理解的理由。我還有另外53個webmethods(get,post)在服務中,並且都運行正常。 我會appriciate任何幫助。

Thx提前。

+0

你可以發佈你調用該服務的代碼! –

+0

沒有意義,代碼有許多類和許多代碼行。但最後生成一個數據集,我轉換它。這發生好。 –

+0

除了我有很多玩相同邏輯的方法。 –

回答

0

我找到了我的問題的解決方案。問題是webmethod工作正常,但是當數據變大時問題開始了。所以,我的問題解決方案付諸webconfig以上的行爲:

<dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="123456" /> 

也在servrice類

ServeiceBehavior(InstanceContextMode= InstanceContextMode.perSession) 

,並在iservice

ServiceContract(SessionMode = SessionMode.Allowed) 

之後,一切工作正常。