简体   繁体   English

如何从Service Fabric Mesh连接到Azure Cosmos DB

[英]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. 我正在尝试创建一个连接到Cosmos DB并在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. CosmosDB URL是HTTPS,因此我尝试添加代码以对网站进行HTTP和HTTPS调用,这给了我类似的错误。

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. 我可以创建到SQL Server数据库的连接。

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 谢谢

This is a known bug - open Dockerfile and add EXPOSE 80 to the first section, ie 这是一个已知的错误-打开Dockerfile并将EXPOSE 80添加到第一部分,即

FROM ... WORKDIR ... EXPOSE 80

then networking starts working. 然后网络开始工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用Azure Cosmos DB连接到Mongo DB - Unable to connect to Mongo DB with Azure Cosmos DB 如何将 Azure Functions 项目连接到本地 Cosmos DB? - How to connect an Azure Functions project to local Cosmos DB? 如何在Azure移动应用服务中获取Cosmos Db数据 - How to Get Cosmos Db Data in Azure Mobile App Service 如何使用Core(SQL)API从Azure Cosmos Db检索数据 - How to retrieve data from Azure Cosmos Db with Core(SQL) API 从Azure函数中的Azure服务总线接收JSON(Cosmos DB文档)作为输入 - Receiving JSON (Cosmos DB Documents) as input from Azure Service Bus in Azure Functions 如何在Azure搜索服务中将Azure Cosmos DB的主键添加为搜索参数 - How to add Primary key of Azure Cosmos DB as search parameter in Azure search Service 无法从 Azure Cosmos DB 获取数据 - Unable to fetch data from Azure Cosmos DB 如何在不使用主键的情况下连接到 ac# 代码中的 azure cosmos db 帐户 - How to connect to azure cosmos db account in a c# code without using primary key 如何调试Azure Cosmos DB存储过程? - How to debug Azure Cosmos DB Stored Procedures? 可以每分钟查询一次Azure Cosmos DB的服务吗? - Is it okay to do a service that query Azure Cosmos DB every minute?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM