azure-cosmosdb – Azure CosmosDB表API – table.CreateIfNotExists()调用挂起

我已经成功下载并运行了Quickstart应用程序,但我无法从我的Web应用程序中获取工作. (当我调用table.CreateIfNotExists()时,执行只是无限期挂起).这显然是与另一个图书馆的冲突,但我无法确定确切的问题.

我已经尝试了我能想到的一切(包括删除并重新安装WindowsAzure.Storage-PremiumTable 0.1.0预览库并安装),但无济于事.怀疑冲突与Microsoft.AspNet.OData库(对于oData v4)有关,我在项目中也需要它.它有一些依赖于Microsoft.Extensions ..(> = 1.0.0&&< 2.0.0),我从其他用户在线阅读是导致类似问题的原因,通过升级到v2修复.0).无论如何,由于Microsoft.AspNet.OData的依赖性,我无法升级这些. 下面是成功时的输出窗口(来自快速入门应用程序或具有最少额外库的其他应用程序):

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 Error: 0 : DocumentClientException with status code: NotFound, message: Message: {"Errors":["Resource Not Found"]}
ActivityId: eed42269-739c-43cd-a964-e8addb2c0a29, Request URI: /apps/cbec8afc-ed09-4565-be2a-46723dded3c3/services/ad31a99f-f874-4862-9dd4-60af25fbc416/partitions/4fd158a1-3b2f-4d61-8ee1-9ee8767d13c1/replicas/131504437541513138s, and response headers: {
"Transfer-Encoding": "chunked",
"x-ms-last-state-change-utc": "Sun, 24 Sep 2017 19:02:14.321 GMT",
"x-ms-schemaversion": "1.3",
"x-ms-xp-role": "2",
"x-ms-global-Committed-lsn": "39",
"x-ms-number-of-read-regions": "0",
"x-ms-request-charge": "2",
"x-ms-serviceversion": "version=1.17.52.1",
"x-ms-activity-id": "eed42269-739c-43cd-a964-e8addb2c0a29",
"x-ms-session-token": "0:40",
"Strict-Transport-Security": "max-age=31536000",
"x-ms-gatewayversion": "version=1.17.52.1",
"Date": "Tue, 26 Sep 2017 19:44:45 GMT",
"Server": "Microsoft-HTTPAPI/2.0",
}

当我调用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();
点赞