AAS 模型暂停和恢复后,尝试打开 ADOMD.net 连接 Returns 307 响应

After AAS Model Pause and Resume, Attempting to Open an ADOMD.net Connection Returns 307 Response

背景

我有一个 API,它使用 ADOMD.Net 客户端从 Azure Analysis Services (AAS) 模型中检索数据。连接是使用连接字符串创建的,该连接字符串包含按记录 here.

获取的访问令牌

问题

API 工作正常,直到 AAS 模型暂停并恢复,这每晚都会发生。在此之后,Model returns 一个 207 Temporary Redirect 响应。

The remote server returned an error: (307) Temporary Redirect.

Technical Details:
RootActivityId: 4d85e2d9-e1ec-406d-92aa-3f3e33ac4ed4
Date (UTC): 3/9/2020 1:09:05 PM

header 中的位置是:

https://asazureweu10-westeurope.asazure.windows.net/webapi/xmla

原始请求(但由 ADOMD.Net 客户提出,而不是我提出)是为了:

https://asazureweu5-westeurope.asazure.windows.net/webapi/xmla

在我重新启动 API 后,客户端开始响应数据并正常运行。这让我相信某些东西正在被缓存,一旦 API 重新启动,缓存可能会被清除?这是连接池问题吗?

有谁知道幕后发生了什么,知道为什么会这样吗?

这是一个已验证的错误,已报告给 MS。

MS 支持工程师说了。

The client library indeed caches this the cluster information in the AppDomain level cache, which has a timeout of 60 minutes. But there is an invalidation code that invalidates the cache on error code >= 300 and <= 399. In this case, the error is 307 so the invalidation logic should still work, as long as the connection is closes and then opened again.

此错误将在 8 月底、9 月初的 Nuget 版本中修复。

更新:此错误现已在 Nuget 包 microsoft.AnalysisServices.AdomdClient.NetCore.retail.amd64,版本 19.9.0.1-Preview.

中修复

我使用的代码片段如下。

        // Catch any error redirection errors and retry. Due to internal workings of lib, if model is scaled up or down, or paused and restarted,
        // the model will come back on a different cluster, so we need to get a new connection.
        catch (AdomdConnectionException ex)
        {
            if ((int) ((HttpWebResponse) ((WebException) ex.InnerException).Response).StatusCode >= 300
                & (int) ((HttpWebResponse) ((WebException) ex.InnerException).Response).StatusCode <= 399)
            {
                aasConnection = await GetOpenAasConnectionAsync(customData, role);
            }
            else throw;
        }