Azure cosmosdb Azure CosmosDB表API-Table.CreateIfNotExists()调用挂起

Azure cosmosdb Azure CosmosDB表API-Table.CreateIfNotExists()调用挂起,azure-cosmosdb,Azure Cosmosdb,我已成功下载并运行了Quickstart应用程序,但无法从web应用程序中运行。(当我调用table.CreateIfNotExists()时,执行将无限期挂起)。很明显,这与另一个图书馆有冲突,但我还不能确定确切的问题 我已经尝试了我能想到的一切(包括删除和重新安装WindowsAzure.Storage-PremiumTable 0.1.0-preview库和安装),但都没有成功。冲突的嫌疑人与Microsoft.AspNet.OData库(用于OData v4)有关,我在项目中也需要该库。

我已成功下载并运行了Quickstart应用程序,但无法从web应用程序中运行。(当我调用table.CreateIfNotExists()时,执行将无限期挂起)。很明显,这与另一个图书馆有冲突,但我还不能确定确切的问题

我已经尝试了我能想到的一切(包括删除和重新安装WindowsAzure.Storage-PremiumTable 0.1.0-preview库和安装),但都没有成功。冲突的嫌疑人与Microsoft.AspNet.OData库(用于OData v4)有关,我在项目中也需要该库。它与Microsoft.Extensions有一些依赖关系。。(>=1.0.0&&<2.0.0),这是我从另一个在线用户那里读到的,是导致类似问题的原因,通过升级到v2.0修复了该问题)。无论如何,由于Microsoft.AspNet.OData的依赖性,我无法升级这些

以下是成功时的输出窗口(来自quickstart应用程序或其他具有最少附加库的应用程序):

这是我调用table.CreateIfNotExists()时项目的输出窗口,即问题

DocDBTrace Information: 0 : Set WriteEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/ ReadEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/
DocDBTrace Information: 0 : TimerPool Created with minSupportedTimerDelayInSeconds = 60
DocDBTrace Information: 0 : RntbdConnectionDispenser: requestTimeoutInSeconds: 60, openTimeoutInSeconds: 0, timerValueInSeconds: 60
DocDBTrace Warning: 0 : Endpoint not reachable. Refresh cache and retry
DocDBTrace Information: 0 : MarkEndpointUnavailable() read EP = https://trfk-cosmos1-neu-northeurope.documents.azure.com/ write EP = https://trfk-cosmos1-neu-northeurope.documents.azure.com/
DocDBTrace Information: 0 : RefreshLocationAsync() refreshing locations
DocDBTrace Information: 0 : Set WriteEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/ ReadEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/
DocDBTrace Warning: 0 : Endpoint not reachable. Refresh cache and retry
DocDBTrace Information: 0 : MarkEndpointUnavailable() read EP = https://trfk-cosmos1-neu-northeurope.documents.azure.com/ write EP = https://trfk-cosmos1-neu-northeurope.documents.azure.com/
DocDBTrace Information: 0 : RefreshLocationAsync() refreshing locations
DocDBTrace Information: 0 : Set WriteEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/ ReadEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/
DocDBTrace Warning: 0 : Endpoint not reachable. Refresh cache and retry
DocDBTrace Information: 0 : MarkEndpointUnavailable() read EP = https://trfk-cosmos1-neu-northeurope.documents.azure.com/ write EP = https://trfk-cosmos1-neu-northeurope.documents.azure.com/
DocDBTrace Information: 0 : RefreshLocationAsync() refreshing locations
DocDBTrace Information: 0 : Set WriteEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/ ReadEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/
DocDBTrace Warning: 0 : Endpoint not reachable. Refresh cache and retry
DocDBTrace Information: 0 : MarkEndpointUnavailable() read EP = https://trfk-cosmos1-neu-northeurope.documents.azure.com/ write EP = https://trfk-cosmos1-neu-northeurope.documents.azure.com/
DocDBTrace Information: 0 : RefreshLocationAsync() refreshing locations
DocDBTrace Information: 0 : Set WriteEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/ ReadEndpoint https://trfk-cosmos1-neu-northeurope.documents.azure.com/

转换为异步应该可以解决这个问题

await table.CreateIfNotExistsAsync();

确保使用最新的nuget软件包,并仔细检查连接字符串格式是否正确。他们在某个时候改变了这一点,这给了我一些问题。您可以在“连接字符串”下的Cosmos DB帐户中的Azure门户中检查这一点。。“主要连接字符串”(或次要连接字符串)

我也有同样的问题,我想知道这是否与正在发现的端点有关,因为表端点的url格式似乎无法直接解析为https://{accountName}.table.cosmosdb.azure.com:443(无CNAME、A等)所以我不确定它是如何计算出底层URL的。您对此有进一步的了解吗?在我的例子中,cosmos db是在SQL模式下创建的,这可能就是表终结点没有解析的原因,目前只是猜测。尽管我的表不会无限期挂起,但它会在30秒左右后唤醒。请确保使用最新的nuget包并仔细检查您是否具有正确的连接字符串格式。他们在某个时候改变了这一点,这给了我一些问题。您可以在“连接字符串”下的Cosmos DB帐户中的Azure门户中检查这一点。。“主要连接字符串”(或次要连接字符串)很酷,谢谢,也许值得将其作为答案发布,以获得一些分数;-)
await table.CreateIfNotExistsAsync();