evo-terren / Gremlin.Net.CosmosDb

Helper library when using Gremlin.Net in conjunction with a Cosmos DB graph
MIT License
62 stars 41 forks source link

I can not connect to cosmos DB emulator. #6

Closed moumenmosa closed 6 years ago

moumenmosa commented 6 years ago

first of all thanks for your pack-edge 😃

i used below connection parameter to connect to my cosmos db emmulator but unfortunatly i face error "Unable to connect to the remote server" and in the inner exception i found below message "The server name or address could not be resolved"

can you please help me in this

private string Endpoint = "https://localhost:8081"; private string Key = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="; private string DatabaseId = "ToDoList"; private string CollectionId = "Items";

using (var graphClient = new GraphClient(Endpoint, DatabaseId, CollectionId, Key)) { var g = graphClient.CreateTraversalSource(); var query1 = g.V("d205415a-f3c3-4f9f-ae17-48057c4ea00b").Out("IstanceOf"); //the error accure below var response = graphClient.SubmitAsync(query1).Result; }

evo-terren commented 6 years ago

Would you be able to give some detail as to what you are trying to connect to (what service lives at your endpoint, or port 8081 on your local machine)? If it helps, this code will ONLY work with a CosmosDB Graph instance, which AFAIK only exists in Azure.

In case you are attempting to test using the CosmosDB emulator, Microsoft states that the emulator only supports the SQL and MongoDB APIs. See https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator for more information.

In case you are trying to connect to a local Gremlin Server instance, use the standard Gremlin.Net library as the server only accepts bytecode, not raw gremlin query strings, which is what my code produces. See https://github.com/apache/tinkerpop/tree/master/gremlin-dotnet for more information.

moumenmosa commented 6 years ago

i figure out the issue i cope the .NET SDK URI instead of Gremlin Endpoint and it is working fine now

thanks 👍