代码之家  ›  专栏  ›  技术社区  ›  Menno van den Heuvel

Bing Ads API:中的端点配置。配置

  •  0
  • Menno van den Heuvel  · 技术社区  · 6 年前

    我有一个ASP。Net MVC(框架版本4.6.2)网站,我试图通过API整合Bing广告活动的每日费用总额。

    我已经添加了包 Microsoft.BingAds.SDK 通过Nuget并针对其编译的类编写了一些代码,所以我想我可以启动它,看看会发生什么。

    结果是:

    找不到引用约定的默认终结点元素 'Microsoft。宾格斯。V11。报告。中的“IReportingService” ServiceModel客户端配置部分。这可能是因为没有 已找到应用程序的配置文件,或者因为没有 在客户端中可以找到与此约定匹配的端点元素 要素

    ReportingServiceClient()的构造函数中发生错误:

    var client = new ReportingServiceClient();
    

    我不知道如何继续。我的中确实没有配置端点。配置文件。我本来希望Nuget添加必要的配置,但什么都没有。我不知道为什么没有,也不知道我应该给自己的生活添加什么。配置。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Eric Urban    6 年前

    您是否有更多详细信息,例如创建和使用服务客户端的代码片段?您使用的是A)ReportingServiceManager还是B)ServiceClient?

    AuthorizationData authorizationData = new AuthorizationData
    {
        // By this point OAuthWebAuthCodeGrant already has 
        // access and refresh tokens
        Authentication = OAuthWebAuthCodeGrant,
        DeveloperToken = "DeveloperTokenGoesHere"
    };
    
    // Option A: ReportingServiceManager
    ReportingServiceManager reportingServiceManager = new ReportingServiceManager(authorizationData);
    
    // Option B: ServiceClient<IReportingService>
    ServiceClient<IReportingService> service = new ServiceClient<IReportingService>(authorizationData);
    

    这是一个 example web solution 来自API文档。我建议你也复习一下 this example from GitHub 使用 ReportingServiceManager

    还请注意,我安装了系统。服务模型。原语4.4.1,系统。服务模型。Http 4.4.1和系统。服务模型。ConfigurationManager 4.4.1(几周前在一些其他版本中遇到问题)作为 documented here

    我希望这有帮助!

    推荐文章