操作错误 [英] operation error

查看:75
本文介绍了操作错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨全部,

在尝试执行以下示例代码时,我收到以下错误

操作错误'发生了内部错误。'(0)遇到


class

Hi All,

while trying to execute the below example code, I get the following error

Operation error 'An internal error has occured.'(0) encountered

class

 

程序

Program

{

 

静态 void Main( string [] args)

{

static void Main(string[] args)

{

GetAllCampaigns(

GetAllCampaigns(

" xxxxx" " xxxx" " " " xxxxxxx" " Xxxxxx" " " ,1111111);

}

"xxxxx", "xxxx", " ", "xxxxxxx", "Xxxxxx", " ", 1111111);

}

 

静态 void GetAllCampaigns( string 用户名, string 密码, string appToken, string devToken, string customerAccountId, string customerId, long accountId)

{

static void GetAllCampaigns(string username,string password,string appToken,string devToken,string customerAccountId,string customerId,long accountId)

{

 

GetCampaignsByAccountIdRequest request = new GetCampaignsByAccountIdRequest ();

request.ApplicationToken = appToken;

GetCampaignsByAccountIdRequest request = new GetCampaignsByAccountIdRequest();

request.ApplicationToken = appToken;

request.CustomerAccountId = customerAccountId;

request.CustomerAccountId = customerAccountId;

request.CustomerId = customerId;

request.CustomerId = customerId;

request.DeveloperToken = devToken;

request.DeveloperToken = devToken;

request.UserName = username;

request.UserName = username;

request.Password = password;

request.Password = password;

request.AccountId = accountId;

request.AccountId = accountId;

 

CampaignManagementServiceClient service = new CampaignManagementServiceClient ();

 

CampaignManagementServiceClient service = new CampaignManagementServiceClient();

 

尝试

{

 

GetCampaignsByAccountIdResponse 响应;

response = service.GetCampaignsByAccountId(request);

GetCampaignsByAccountIdResponse response;

response = service.GetCampaignsByAccountId(request);

 

foreach 广告系列 广告系列 response.Campaigns)

{

foreach (Campaign campaign in response.Campaigns)

{

 

控制台 。WriteLine(campaign.Name);

}

Console.WriteLine(campaign.Name);

}

}

 

//异常处理。

 

//捕获任何一般错误。

 

catch FaultException < AdApiFaultDetail > adApiFault)

{

catch (FaultException<AdApiFaultDetail> adApiFault)

{

 

//获取AdApiFaultDetail对象。

 

AdApiFaultDetail detail = adApiFault.Detail;

 

AdApiFaultDetail detail = adApiFault.Detail;

 

foreach AdApiError 错误 detail.Errors)

{

foreach (AdApiError error in detail.Errors)

{

 

控制台 。写( "Ad API错误" );

 

Console.Write("Ad API error");

 

控制台 。WriteLine( "遇到"{0}"({1})。"

error.Message,

Console.WriteLine(" '{0}' ({1}) encountered.",

error.Message,

error.Code);

error.Code);

}

}

 

//捕获任何adCenter API例外。

 

catch < span style ="font-size:x-small">( FaultException < ApiFaultDetail > fault)

{

catch (FaultException<ApiFaultDetail> fault)

{

 

ApiFaultDetail detail = fault.Detail;

 

ApiFaultDetail detail = fault.Detail;

 

//显示任何服务操作错误。

 

foreach < span style ="font-size:x-small">( OperationError opError detai l.OperationErrors)

{

foreach (OperationError opError in detail.OperationErrors)

{

 

控制台 。写( < span style ="color:#a31515; font-size:x-small">"操作错误" );

 

Console.Write("Operation error");

 

控制台 .WriteLine( "遇到"{0}"({1})。"

opError.Message,

Console.WriteLine(" '{0}' ({1}) encountered.",

opError.Message,

opError.Code);

opError.Code);

}

}

 

最后

{

service.Close();

service.Close();

}

}

 

 

}

}

推荐答案

作为旁注,代码片段不是特别有用,因为它们不捕获传递的参数。 SOAP请求最有用,但可以包含机密信息。在这种情况下,请打开支持票。 FYI,内部错误最常发生在传递无效ObjectID时。使用相应的Get操作来验证ID。

Jeff Dillon,API支持
As a side note, code snippets are not particularly useful, since they don't capture the parameters that are passed. The SOAP request is most helpful, but can contain confidential information. In that case, please open a support ticket. FYI, Internal Error most often occurs when invalid ObjectID's are passed. Use corresponding Get operations to verify the id's.

Jeff Dillon, API Support


这篇关于操作错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆