2013-07-04 99 views
0

在我的asp.net web應用程序中,我使用亞馬遜插件來加載書籍圖像和相應的isbn.in代碼,後面我將該圖像轉換爲字節數組存儲到數據庫中。但問題是它有時會返回一個錯誤看到圖片 Error message遠程名稱無法解析:'images.amazon.com'

可以任何指定此錯誤的原因,並請建議我一些解決方案。提前感謝。

回答

0

當您達到油門限制時會發生這種情況。

嘗試將您的代碼包裝在try catch塊中

例如:

void withretry(string query) 
{ 
    ListMatchingProductsRequest request = new ListMatchingProductsRequest(); 
    request.SellerId = amazonsetting.merchantId; 
    request.MarketplaceId = amazonsetting.marketplaceId; 
    request.QueryContextId = "Books"; 
    request.Query = query; 
    try 
    { 
     ListMatchingProductsResponse response = amazonsetting.service.ListMatchingProducts(request); 
     if (response.IsSetListMatchingProductsResult()) 
     { 
      ListMatchingProductsResult listMatchingProductsResult = response.ListMatchingProductsResult; 
      if (listMatchingProductsResult.IsSetProducts()) 
      { 
       ProductList products = listMatchingProductsResult.Products; 
       List<Product> productList = products.Product; 
       Product product = productList[0]; 
       if (product.IsSetIdentifiers()) 
       { 
        IdentifierType identifiers = product.Identifiers; 
        if (identifiers.IsSetMarketplaceASIN()) 
        { 
         ASINIdentifier marketplaceASIN = identifiers.MarketplaceASIN; 
         if (marketplaceASIN.IsSetMarketplaceId()) 
         { 
         } 
         if (marketplaceASIN.IsSetASIN()) 
         { 
          asin = marketplaceASIN.ASIN; 
         } 
        } 
       } 
       if (product.IsSetAttributeSets()) 
       { 
        foreach (var attribute in product.AttributeSets.Any) 
        { 
         msg += ProductsUtil.FormatXml((System.Xml.XmlElement)attribute); 
        } 
       } 

      } 
      parsemsg(); 

     } 
    } 
    catch (Exception ex) 
    { 
     string type = ex.Message; 
     if (type=="Request is throttled") 
     { 
      if (cnt<=maxretry) 
      { 
       cnt++; 
       withretry(query); 
      } 

     } 


    } 
} 

這將繼續重試,直到maxretry達到。

+0

感謝您的快速回復。我會盡力讓您知道結果。 – samiaj

+0

Thanks.it's曾爲我效勞 – samiaj

+0

如果答案已經幫助您,然後標記爲接受。 – Ratna

相關問題