【问题标题】:Error Calling DescribeIndexFieldsAsync on AmazonCloudSearchClient在 AmazonCloudSearchClient 上调用 DescribeIndexFieldsAsync 时出错
【发布时间】:2016-05-17 21:43:13
【问题描述】:

我已确认我有权执行该请求。

根据亚马逊的Cloud Search Dev Troubleshooting Guide,我遇到的错误可能是由于 .net sdk 使用了错误的 api 版本。我看不到明确指定 api 版本的方法。

我想避免手动创建 http 请求。

我想通过 SDK 发出请求。

我已经尝试了所有可用的 SDK 版本,所有版本都给我这个错误。

我还尝试以各种组合指定请求属性。没有任何效果。

谁能指导我如何解决这个问题?

预期行为:返回所有索引字段的信息

实际行为:

错误 - “结果消息:
Amazon.Runtime.AmazonUnmarshallingException :从 AWS 解组响应时出错。响应正文:{ "message": "行政规则禁止的请求", "__type": "CloudSearchException" }"

----> System.Xml.XmlException : 根级别的数据无效。第 1 行,位置 1。

代码示例:

var _configClient = new AmazonCloudSearchClient(
                    WebConfigurationManager.AppSettings["CloudSearchAccessKey"],
                    WebConfigurationManager.AppSettings["CloudSearchSecretKey"],
                    new AmazonCloudSearchConfig
                    {
                        RegionEndpoint = RegionEndpoint.USWest2,
                        ServiceURL = WebConfigurationManager.AppSettings["CloudSearchUrl"]
                    });

await _configClient.DescribeIndexFieldsAsync(new DescribeIndexFieldsRequest())

【问题讨论】:

    标签: c# .net sdk amazon-cloudsearch


    【解决方案1】:

    CloudSearch 正在返回 json,您可以在响应正文中看到它,并且 SDK 正在尝试将其解组为 xml。直接查询时,可以加&format=xml,获取xml结果。 SDK 中应该有类似的选项。

    【讨论】:

    • 感谢您的建议。我没有看到 .Net SDK 的任何此类选项。在构造函数参数或方法参数中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-18
    • 1970-01-01
    • 2023-03-03
    • 2014-08-12
    • 1970-01-01
    相关资源
    最近更新 更多