yojimbo87 / ArangoDB-NET

C#/.NET/Mono driver for ArangoDB
MIT License
107 stars 66 forks source link

ArangoDB-NET Error: System.Net.WebException: 'No such host is known No such host is known' #61

Closed csharpbd closed 3 years ago

csharpbd commented 3 years ago

I'm getting an error while I'm trying to connect the ArangoDB Cloud (ArangoDB Oasis) database. It is working fine with my local installed ArangoDB database. The driver is returning an error when I'm trying to deploy the database in ArangoDB Cloud (ArangoDB Oasis).

Error: System.Net.WebException: 'No such host is known No such host is known'

image

Connection String Settings:

  "DatabaseSettings": {
    "ConnectionName": "CloudDBConnection",
    "Host": "https://xxxxxxxx.arangodb.cloud",
    "Port": 8529,
    "UserName": "root",
    "Password": "xxxxxxxx",
    "DatabaseName": "KKBDTestDB"
  }

Database Connection:

private readonly ADatabase db;
public DatabseService(IDatabaseSettings settings)
{
    ASettings.AddConnection(settings.ConnectionName, settings.Host, settings.Port, false, settings.DatabaseName, settings.UserName, settings.Password, true);
    db = new ADatabase(settings.ConnectionName);
}
csharpbd commented 3 years ago

One of my colleagues found the solution. There are two steps to solve the issue.

1) Remove HTTPS from your hostname

Connection string should be:

"DatabaseSettings": {
    "ConnectionName": "CloudDBConnection",
    "Host": "xxxxxxxx.arangodb.cloud",
    "Port": 8529,
    "UserName": "root",
    "Password": "xxxxxxxx",
    "DatabaseName": "KKBDTestDB"
}

2) Download the public key for windows from the ArangoDB cloud and follow the following steps:

Convert Certificate (PEM) to ca-xxxxxxx.crt
Open a Powershell with Run as Administrator
certutil -addstore root ca-xxxxxxx.crt