2013-06-05 147 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) 

之后,一切工作正常。