CosmosDb 提供程序正在发送此消息:
“响应状态代码不表示成功:503 子状态:0 原因:(请求失败,因为客户端无法与 1 个区域的 3 个端点建立连接。请检查客户端资源匮乏问题并验证客户端和服务器之间的连接。”
在我的测试中,它有效(.net core 3.1):
Task.Run(async () =>
{
var endpoint = “test”;
var masterKey = “test”;
using (var client = new DocumentClient(new Uri(endpoint), masterKey))
{
//Insert new Document
Console.WriteLine("\r\n>>>>>>>>>>>>>>>> Creating Document <<<<<<<<<<<<<<<<<<<");
dynamic candidato = new
{
Id = 1,
Nome = "Test"
};
var document1 = await client.CreateDocumentAsync(
UriFactory.CreateDocumentCollectionUri("Test", "Test"),
candidato);
Console.ReadKey();
}
}).Wait();
Run Code Online (Sandbox Code Playgroud)
它不是:
Task.Run(async () =>
{
using (var context = new StudentsDbContext())
{
context.Add(new FamilyContainer(2, "Test"));
await context.SaveChangesAsync(); …Run Code Online (Sandbox Code Playgroud)