我在使用高数字(> 20)广告素材ID调用LIST时遇到此异常。使用大约10个广告素材调用LIST时,它可以正常工作,每次调用大约需要30秒。
以下是例外情况:
Google.GoogleApiException was caught HResult=-2146233088 Message=Google.Apis.Requests.RequestError Backend Error [500] Errors [ Message[Backend Error] Location[ - ] Reason[backendError] Domain[global] ]
Source=Google.Apis ServiceName=adexchangebuyer StackTrace: at Google.Apis.Requests.ClientServiceRequest`1.Execute() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis\Apis\Requests\ClientServiceRequest.cs:line 102 InnerException:
这是使用Google.Apis.AdExchangeBuyer.v1_3 1.9.0.48的调用代码:(我也尝试使用1.9.0.51)
var listRequest = this.AdexchangebuyerService.Creatives.List();
listRequest.MaxResults = 1000;
listRequest.BuyerCreativeId = new Repeatable<string>(creativeIds );
// creativeIds is IEnumerable<string>; (fails with 20 creative ids, passes with 10)
var listOfCreatives = listRequest.Execute(); // -- exception thrown here
使用客户端库在fiddler中捕获的请求:
GET https://www.googleapis.com/adexchangebuyer/v1.3/creatives?key={YOUR_API_KEY}&pageToken=mypagetoken&maxResults=1000&buyerCreativeId=i7bhb44u&buyerCreativeId=f5bfbul2
HTTP/1.1
User-Agent: AdExchangeBuyer google-api-dotnet-client/1.9.1.12394 (gzip)
这是使用网络界面(https://developers.google.com/ad-exchange/buyer-rest/v1.3/creatives/list)的请求:
GET https://www.googleapis.com/adexchangebuyer/v1.3/creatives?buyerCreativeId=i7bhb44u&buyerCreativeId=f5bfbul2&key={YOUR_API_KEY}
答案 0 :(得分:0)
看起来呼叫太长了,你有点超时。所以我建议尝试下列之一:
更改默认超时的数字高于默认值(我读到的地方是100,但我没有在官方文档中找到它 - https://msdn.microsoft.com/en-us/library/system.net.http.httpclient.timeout%28v=vs.118%29.aspx)。您可以执行以下操作:
this.AdexchangebuyerService.HttpClient.Timeout =
TimeSpan.FromSeconds(200);