2017-09-27 67 views
3

我已经下载并成功运行了快速入门应用程序,但无法从我的Web应用程序中获取工作。 (当我调用table.CreateIfNotExists()时,执行只能无限期地挂起)。这显然是与另一个图书馆的冲突,但我一直没有找到确切的问题。Azure CosmosDB表API - 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/ 

回答

1

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

await table.CreateIfNotExistsAsync();