Cosmos DB. Why it is getting stuck?

Nikolay Renziglov 21 Reputation points
2020-07-17T18:15:05.86+00:00

Hi there
In my Blazor Server the following code line just get stuck:

container = await database.CreateContainerIfNotExistsAsync(typeof(T).Name, partitionId);

T is my business class, partitionId is "/FacilityId". It just release the main thread and end up nowhere without continuation.

Same code works fine if the application is WPF. What can be a reason for the problem?
Thanks.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,632 questions
{count} votes

Accepted answer
  1. Mike Ubezzi 2,776 Reputation points
    2020-07-17T23:58:43.147+00:00

    Hi @NikolayRenziglov-9001 - Can you detaill where your Blazor Server is hosted? I don't think that method will work without a correct SignalR binding through Azure Functions. Please see the following: SignalR Service bindings for Azure Functions and an example scenario where the specific SignalR Service Bindings for Azure Functions and Azure Cosmos DB trigger and bindings for Azure Functions 2.x and higher overview detail the specific version compatibility. I cannot find an example of using SignalR as the Cosmos DB directly.

    Blazor Server apps use ASP.NET Core SignalR to communicate with the browser. SignalR's hosting and scaling conditions apply to Blazor Server apps.

    Blazor works best when using WebSockets as the SignalR transport due to lower latency, reliability, and security. Long Polling is used by SignalR when WebSockets isn't available or when the app is explicitly configured to use Long Polling. When deploying to Azure App Service, configure the app to use WebSockets in the Azure portal settings for the service. For details on configuring the app for Azure App Service, see the SignalR publishing guidelines.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.