0

In my asp.net web application i am using amazon plugin to load book images with corresponding isbn.in code behind i am converting that image into byte array for storing that into database.But the problem is it some times come back with an error see picture Error message

Can any specify the reason for this error and please suggest me some solutions.Thanks in advance.

4

1 回答 1

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。

于 2013-07-04T10:26:47.797 回答