我正在尝试为搜索服务建立一些数据索引,并使用政府云中的搜索查询来检索这些数据。搜索服务Url以(.search.azure.us)结尾。这与普通的azure搜索服务不同,在这种服务中,URL以(.search.windows.net)结尾。
我们的团队使用Azure .Net SDK版本5,我发现当我使用服务名称创建SearchIndexClient时,构造函数会验证服务url,并始终在其末尾附加.search.windows.net,而对于像*.search.azure.us这样的gcc url,它将失败。
我正在查看Azure搜索客户端库,SearchIndexClient总是使用.search.wndows.net后缀进行验证
private static void ValidateSearchServiceAndIndexNames(string searchServiceName, string indexName)
{
Throw.IfNullOrEmptySearchServiceName(searchServiceName);
SearchIndexClient.ThrowIfNullOrEmptyIndexName(indexName, nameof (indexName));
if (TypeConversion.TryParseUri(string.Format("https://{0}.search.windows.net/indexes('{1}')/",
(object) searchServiceName, (object) indexName)) == (Uri) null)
throw new ArgumentException(string.Format("Either the search service name '{0}' or the index name
'{1}' is invalid. Names must contain only characters that are valid in a URL.", (object)
searchServiceName, (object) indexName), nameof (searchServiceName));
} 那么有没有升级版的sdk可以让搜索索引客户端支持像".search.azure.us“这样的URL?或任何其他推荐的政府云urls的方式?
就像在searchIndexClient上正确地将SearchDnsSuffix属性设置为适当的后缀一样简单吗?
发布于 2020-03-24 08:46:21
你能分享你是如何实例化你的SearchIndexClient的吗?我的直觉是,您在搜索服务或索引名称中包含了域名后缀,这将触发您看到的错误。尝试将SearchDnsSuffix设置为"search.azure.us“。
https://stackoverflow.com/questions/60822415
复制相似问题