当我试图在azure Cloud 服务“worker role”项目上测试我的代码时,出现了一些奇怪的问题 . 该代码在“Web API”和“控制台应用程序”项目上运行良好 .

var databaseDefinition = new Microsoft.Azure.Documents.Database { Id = DatabaseName };
    _dbClient = new DocumentClient(new Uri(EndpointUrl), AuthorizationKey);
    var result = await _dbClient.CreateDatabaseIfNotExistsAsync(databaseDefinition);
    var collectionDefinition = new DocumentCollection { Id = CollectionId };

    try
    {

       var result = await_dbClient.CreateDocumentCollectionIfNotExistsAsync(_dbLink.CollectionsLink, collectionDefinition);
    }
    catch (Exception e)
    {
       throw e;
    }

但每当我尝试运行worker角色项目并初始化我的DocumentDB仓库时,会出现以下错误:

"The input authorization token can't serve the request. Please check that the expected payload is built as per the protocol, and check the key being used. Server used the following payload to sign: 'get colls dbs/MyDatabase/colls/MyCollection"

完全相同的代码在控制台应用程序和Web API上运行完美 . 我正在使用带有DocumentDB SDK的Azure CosmosDB .

有任何想法吗?谢谢 .