我試圖使用Neo4j的淨驅動我當地的Neo4j數據庫溝通,從Xamarin應用程序中。法「Sockets.Plugin.Abstractions.ITcpSocketClient.ConnectAsync」未找到(Neo4j的驅動程序)
這是我的代碼:
using Neo4j.Driver.V1; // I have this at the top of the class
//and this in the constructor just to test it
using (var driver = GraphDatabase.Driver("bolt://localhost", AuthTokens.Basic("neo4j", "root")))
using (var session = driver.Session())
{
session.Run("CREATE (a:User {name:'Arthur'})");
}
它本質上是他們給的,在其網站(https://neo4j.com/developer/language-guides/)的例子相同的代碼。
當我嘗試運行項目中,我得到以下錯誤:
System.AggregateException: One or more errors occurred. ---> System.MissingMethodException: Method 'Sockets.Plugin.Abstractions.ITcpSocketClient.ConnectAsync' not found.
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00031] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316
at Neo4j.Driver.Internal.Connector.SocketClient.Start() [0x00023] in <d05dc2e6bd2a40acab42430b347d4724>:0
at Neo4j.Driver.Internal.Connector.SocketConnection.<.ctor>b__3_0() [0x00000] in <d05dc2e6bd2a40acab42430b347d4724>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke() [0x00012] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:680
at System.Threading.Tasks.Task.Execute() [0x00016] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00014] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2157
at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00052] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3189
at System.Threading.Tasks.Task.Wait() [0x00000] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3054
at Neo4j.Driver.Internal.Connector.SocketConnection..ctor (Neo4j.Driver.Internal.Connector.ISocketClient socketClient, Neo4j.Driver.V1.IAuthToken authToken, Neo4j.Driver.V1.ILogger logger, Neo4j.Driver.Internal.Messaging.IMessageResponseHandler messageResponseHandler) [0x00046] in <d05dc2e6bd2a40acab42430b347d4724>:0
at Neo4j.Driver.Internal.Connector.SocketConnection..ctor (System.Uri url, Neo4j.Driver.V1.IAuthToken authToken, Neo4j.Driver.V1.Config config) [0x00016] in <d05dc2e6bd2a40acab42430b347d4724>:0
at Neo4j.Driver.Internal.Session..ctor (System.Uri uri, Neo4j.Driver.V1.IAuthToken authToken, Neo4j.Driver.V1.Config config, Neo4j.Driver.Internal.Connector.IConnection conn, System.Action`1[T] releaseAction) [0x0005c] in <d05dc2e6bd2a40acab42430b347d4724>:0
at Neo4j.Driver.Internal.SessionPool.<GetSession>b__14_0() [0x0003b] in <d05dc2e6bd2a40acab42430b347d4724>:0
at Neo4j.Driver.Internal.LoggerBase.TryExecute[T] (System.Func`1[TResult] func) [0x00000] in <d05dc2e6bd2a40acab42430b347d4724>:0
我試圖尋找通過Neo4j的手冊(http://neo4j.com/docs/operations-manual/current/)和網上搜索,但沒有找到一個解決方案。
謝謝!這解決了這個問題。然後,我只需要將「bolt:// localhost」更改爲「bolt://127.0.0.1:7687」,以便完美地工作 –