2016-06-05 7 views
1

이베이 (Ebay)의 모든 카테고리를 데이터베이스에 저장하려고 시도했습니다. 기본 API 컨텍스트의 시간 초과 값을 늘리려고했지만 약 2 분 후에도 시간 제한을받습니다. 그 밖의 필요한 작업은 무엇입니까?eBay API - getCategories timeout

 var c = new eBay.Service.Call.GetCategoriesCall(this.apiContext); 
     c.CategorySiteID = ((int)siteId).ToString(); // siteId is an eBay SiteCode enum value 
     var version = c.GetCategoriesVersion(); 
     c.DetailLevelList = new DetailLevelCodeTypeCollection(); 
     c.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); 
     c.ViewAllNodes = !onlyLeafCategories; 
     c.Timeout = 1000*60*20; 
     c.GetCategories(); // this causes a connection closed/timeout 

답변

0

이 코드를 시도, 그것은 나를 위해 작동 :

// get all categories from eBay 
        ApiContext context = GetApiContext(); 

        GetCategoriesCall apiCall = new GetCategoriesCall(context) 
        { 
         EnableCompression = true, 
         ViewAllNodes = true 

        }; 
        apiCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); 
        apiCall.GetCategories(); 

    public static ApiContext GetApiContext() 
    { 
     //apiContext is a singleton, 
     //to avoid duplicate configuration reading 
     if (apiContext != null) 
     { 
      return apiContext; 
     } 
     else 
     { 
      apiContext = new ApiContext(); 

      //set Api Server Url 
      apiContext.SoapApiServerUrl = "https://api.ebay.com/wsapi"; 

      //set Api Token to access eBay Api Server 
      ApiCredential apiCredential = new ApiCredential(); 
      apiCredential.eBayToken ="YOUR_TOKEN"; 
      apiContext.ApiCredential = apiCredential; 
      //set eBay Site target to US 
      apiContext.Site = eBay.Service.Core.Soap.SiteCodeType.US; 
      return apiContext; 
     } 
    }