尝试从 Bot Framework 4.6 连接到 Cosmos DB 时出现 404
404 when trying to connect to Cosmos DB from Bot Framework 4.6
当我尝试从 Bot Framework 4.6 连接到 Cosmos DB 时,我不确定连接字符串的格式是否正确:
IStorage memoryStorage = null;
// memoryStorage = new MemoryStorage();
memoryStorage = new CosmosDbPartitionedStorage(
new CosmosDbPartitionedStorageOptions
{
CosmosDbEndpoint = "https://myDB.mongo.cosmos.azure.com:443/",
AuthKey = "MyKey",
DatabaseId = "dev",
ContainerId = "conversation-state"
}
);
var conversationState = new Models.ConversationState(memoryStorage);
var UserState = new UserState(memoryStorage);
services.AddSingleton(conversationState);
services.AddSingleton(UserState);
Cosmos 服务 URL 使用此处的文档似乎是正确的:https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-v4-storage?view=azure-bot-service-4.0&tabs=csharp#memory-storage
它说要使用 SSL,所以我使用端口 443,但连接字符串上的端口说 10255
我错过了什么?
这是我收到的错误消息:
The bot encounted an error or bug: Response status code does not
indicate success: 404 Substatus: 0 Reason: (, Request URI: /,
RequestStats: , SDK: Windows/10.0.17763 cosmos-netstandard-sdk/3.2.1).
从您的端点和屏幕截图来看,您似乎在创建 CosmosDB 时 select 编辑了 "Azure Cosmos DB for MongoDB API"。您需要 select 核心。
API 类型确定 "how" 您与 CosmosDB 服务交互,CosmosDbPartitionedStorage
使用 "Core" CosmosDB API 而不是 MongoDB API.
有点"buried",我就叫出来吧。 the docs(强调我的)中对此进行了描述:
- On the New account page, provide Subscription, Resource group information. Create a unique name for your Account Name field - this eventually becomes part of your data access URL name. For API, select Core(SQL), and provide a nearby Location to improve data access times.
当我尝试从 Bot Framework 4.6 连接到 Cosmos DB 时,我不确定连接字符串的格式是否正确:
IStorage memoryStorage = null;
// memoryStorage = new MemoryStorage();
memoryStorage = new CosmosDbPartitionedStorage(
new CosmosDbPartitionedStorageOptions
{
CosmosDbEndpoint = "https://myDB.mongo.cosmos.azure.com:443/",
AuthKey = "MyKey",
DatabaseId = "dev",
ContainerId = "conversation-state"
}
);
var conversationState = new Models.ConversationState(memoryStorage);
var UserState = new UserState(memoryStorage);
services.AddSingleton(conversationState);
services.AddSingleton(UserState);
Cosmos 服务 URL 使用此处的文档似乎是正确的:https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-v4-storage?view=azure-bot-service-4.0&tabs=csharp#memory-storage
它说要使用 SSL,所以我使用端口 443,但连接字符串上的端口说 10255
我错过了什么?
这是我收到的错误消息:
The bot encounted an error or bug: Response status code does not indicate success: 404 Substatus: 0 Reason: (, Request URI: /, RequestStats: , SDK: Windows/10.0.17763 cosmos-netstandard-sdk/3.2.1).
从您的端点和屏幕截图来看,您似乎在创建 CosmosDB 时 select 编辑了 "Azure Cosmos DB for MongoDB API"。您需要 select 核心。
API 类型确定 "how" 您与 CosmosDB 服务交互,CosmosDbPartitionedStorage
使用 "Core" CosmosDB API 而不是 MongoDB API.
有点"buried",我就叫出来吧。 the docs(强调我的)中对此进行了描述:
- On the New account page, provide Subscription, Resource group information. Create a unique name for your Account Name field - this eventually becomes part of your data access URL name. For API, select Core(SQL), and provide a nearby Location to improve data access times.