首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >支持政务社区云中的Azure搜索服务(gcc)

支持政务社区云中的Azure搜索服务(gcc)
EN

Stack Overflow用户
提问于 2020-03-24 06:29:51
回答 1查看 75关注 0票数 1

我正在尝试为搜索服务建立一些数据索引,并使用政府云中的搜索查询来检索这些数据。搜索服务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后缀进行验证

代码语言:javascript
复制
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属性设置为适当的后缀一样简单吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-24 08:46:21

你能分享你是如何实例化你的SearchIndexClient的吗?我的直觉是,您在搜索服务或索引名称中包含了域名后缀,这将触发您看到的错误。尝试将SearchDnsSuffix设置为"search.azure.us“。

参考文档:https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.search.searchindexclient.searchdnssuffix?view=azure-dotnet#Microsoft_Azure_Search_SearchIndexClient_SearchDnsSuffix

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60822415

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档