如果您在开发环境中安装Neo4j,那么您将拥有Neo4Jserver的本地托管版本,通常可以使用以下版本浏览:localhost:7474 / db / data。
您的代码是这样的:
var client = new GraphClient(new Uri("http://localhost:7474/db/data"));
client.Connect();
然而,有一天你会想要连接到基于云的Neo4J服务器(Heroku,Azure等) 当然,这意味着您必须提供网络凭据。 如果你只是赤手空拳,它可能是这样的:
var http = (HttpWebRequest)WebRequest.Create(new Uri("http://<<your_REST_query"));
var cred = new NetworkCredential("yourusername", "yourpassword");
http.Credentials = cred;
var response = http.GetResponse();
var stream = response.GetResponseStream();
但是如何包含网络凭据以连接Neo4JClient?还是有其他选择我不知道?
答案 0 :(得分:1)
我们支持基本身份验证凭据的标准URI语法:
var client = new GraphClient(new Uri("http://user:pass@localhost:7474/db/data"));
答案 1 :(得分:0)
var username = "app_username"
var password = "1@mGr@phG0d"
var client = new GraphClient(new Uri("http://localhost:7474/db/data"), username, password);