Search code examples
c#azureazure-cosmosdbazure-service-fabric-mesh

How to connect to Azure Cosmos DB from Service Fabric Mesh


I'm trying to create an application that connects to a Cosmos DB and runs on Service Fabric Mesh. I've created a simple console application that tries to make the connection

var client = new Microsoft.Azure.Documents.Client.DocumentClient(new Uri(***), ***);

client.OpenAsync().Wait();

This causes an error "No such host is known"

The CosmosDB URL is HTTPS, so I tried adding code to make HTTP and HTTPS calls to a website, which gave me a similar error.

Question Is there some config I need to allow my code external access to specific ports outside of the cluster?

I can create a connection to a SQL Server database.

At the minute I'm just trying to debug the code locally. I can connect if I run the code away from the cluster in a standalone console application.

Thanks


Solution

  • This is a known bug - open Dockerfile and add EXPOSE 80 to the first section, i.e.

    FROM ... WORKDIR ... EXPOSE 80

    then networking starts working.