Gremlin.net.dll 未找到

huangapple go评论54阅读模式
英文:

Gremlin.net.dll not found

问题

在从Gremlin.net 3.6.1升级到3.6.2时,我遇到了一个文件未找到异常,指向"rootOfProject"/Gremlin.net.dll。这发生在我的startup.cs中,当实例化GremlinClient时。

我已经尝试将Gremlin.net.dll复制到项目的根文件夹。然后它可以正常工作。
我发现代码突然在根目录而不是\bin文件夹中寻找.dll文件,这很奇怪。

英文:

when moving from Gremlin.net 3.6.1, to 3.6.2 I get a FileNotFound Exception pointing to "rootOfProject"/Gremlin.net.dll
This is happening in my startup.cs when instantiating the GremlinClient

services.AddSingleton<GremlinClient>(s =>
            {
                GremlinServer server = new GremlinServer(hostname: "host", port: 443, enableSsl: true, username: $"collection", password: "password"]);
                var connectionPoolSettings = new ConnectionPoolSettings
                {
                    MaxInProcessPerConnection = 32,
                    PoolSize = 4,
                    ReconnectionAttempts = 4,
                    ReconnectionBaseDelay = TimeSpan.FromSeconds(1)
                };

                var socket = new Action<ClientWebSocketOptions>(o =>
                {
                    o.KeepAliveInterval = TimeSpan.FromSeconds(10);
                });
            return new GremlinClient(server, new GraphSON2MessageSerializer(), connectionPoolSettings, socket);

I have tried to copy the Gremlin.net.dll to the root folder of the project. And then it works.
I find it strange that the code is suddenly looking for the .dll at the root and not in the \bin folder

----------
{
"developerMessage": "One or more errors occurred. (Could not find file 'C:\\SourceEquinor\\repos\\mad-vsm-api\\Equinor.Vsm.Api\\Gremlin.Net.dll'.)",
"userMessage": "Server error, contact system responsible",
"code": "500",
"httpStatusCode": 500,
"exception": {
"ClassName": "System.AggregateException",
"Message": "One or more errors occurred.",
"Data": null,
"InnerException": {
"ClassName": "System.IO.FileNotFoundException",
"Message": "Could not find file 'C:\\SourceEquinor\\repos\\mad-vsm-api\\Equinor.Vsm.Api\\Gremlin.Net.dll'.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": "   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)\r\n   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)\r\n   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)\r\n   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)\r\n   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)\r\n   at System.Reflection.Metadata.MetadataReader.GetAssemblyName(String assemblyFile)\r\n   at Gremlin.Net.Process.Utils.GenerateUserAgent()\r\n   at Gremlin.Net.Process.Utils.get_UserAgent()\r\n   at Gremlin.Net.Driver.WebSocketConnection..ctor(IClientWebSocket client, WebSocketSettings settings)\r\n   at Gremlin.Net.Driver.ConnectionFactory.CreateConnection()\r\n   at Gremlin.Net.Driver.ConnectionPool.CreateNewConnectionAsync()\r\n   at Gremlin.Net.Driver.ConnectionPool.FillPoolAsync()",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2147024894,
"Source": "System.Private.CoreLib",
"WatsonBuckets": null,
"FileNotFound_FileName": "C:\\SourceEquinor\\repos\\mad-vsm-api\\Equinor.Vsm.Api\\Gremlin.Net.dll",
"FileNotFound_FusionLog": null
},
"HelpURL": null,
"StackTraceString": "   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\r\n   at Gremlin.Net.Driver.ConnectionPool.FillPoolAsync()\r\n   at Gremlin.Net.Driver.ConnectionPool.ReplaceDeadConnectionsAsync()\r\n   at Gremlin.Net.Process.Utils.WaitUnwrap(Task task)\r\n   at Gremlin.Net.Driver.ConnectionPool..ctor(IConnectionFactory connectionFactory, ConnectionPoolSettings settings, ILogger`1 logger)\r\n   at Gremlin.Net.Driver.GremlinClient..ctor(GremlinServer gremlinServer, IMessageSerializer messageSerializer, ConnectionPoolSettings connectionPoolSettings, Action`1 webSocketConfiguration, String sessionId, Boolean disableCompression, ILoggerFactory loggerFactory)\r\n   at Equinor.Vsm.Api.Startup.<>c__DisplayClass7_0.<ConfigureServices>b__8(IServiceProvider s) in C:\\SourceEquinor\\repos\\mad-vsm-api\\Equinor.Vsm.Api\\Startup.cs:line 205\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)\r\n   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)\r\n   at MediatR.Wrappers.RequestHandlerWrapperImpl`2.<>c__DisplayClass1_0.<Handle>g__Handler|0()\r\n   at Equinor.Vsm.Api.Application.Behaviors.DiscardGraphCacheBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken) in C:\\SourceEquinor\\repos\\mad-vsm-api\\Equinor.Vsm.Api\\Application\\Behaviours\\DiscardGraphCacheBehavior.cs:line 23\r\n   at Equinor.Vsm.Api.Application.Behaviors.ValidationBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)\r\n   at Equinor.Vsm.Api.Controllers.V2.GraphController.MoveVertex(IGremlinQuerySource g, String projectId, MoveCommandDto moveCommand) in C:\\SourceEquinor\\repos\\mad-vsm-api\\Equinor.Vsm.Api\\Controllers\\V2\\GraphController.cs:line 88\r\n   at lambda_method30(Closure, Object)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)\r\n   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)\r\n   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233088,
"Source": "System.Private.CoreLib",
"WatsonBuckets": null,
"InnerExceptions": [
{
"ClassName": "System.IO.FileNotFoundException",
"Message": "Could not find file 'C:\\SourceEquinor\\repos\\mad-vsm-api\\Equinor.Vsm.Api\\Gremlin.Net.dll'.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": "   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)\r\n   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)\r\n   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)\r\n   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)\r\n   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)\r\n   at System.Reflection.Metadata.MetadataReader.GetAssemblyName(String assemblyFile)\r\n   at Gremlin.Net.Process.Utils.GenerateUserAgent()\r\n   at Gremlin.Net.Process.Utils.get_UserAgent()\r\n   at Gremlin.Net.Driver.WebSocketConnection..ctor(IClientWebSocket client, WebSocketSettings settings)\r\n   at Gremlin.Net.Driver.ConnectionFactory.CreateConnection()\r\n   at Gremlin.Net.Driver.ConnectionPool.CreateNewConnectionAsync()\r\n   at Gremlin.Net.Driver.ConnectionPool.FillPoolAsync()",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2147024894,
"Source": "System.Private.CoreLib",
"WatsonBuckets": null,
"FileNotFound_FileName": "C:\\SourceEquinor\\repos\\mad-vsm-api\\Equinor.Vsm.Api\\Gremlin.Net.dll",
"FileNotFound_FusionLog": null
}
]
}
}

答案1

得分: 2

观看 https://github.com/apache/tinkerpop/pull/2005。当它被合并时,下一个发布版本将包含修复。

英文:

Watch https://github.com/apache/tinkerpop/pull/2005. When it gets merged, the next release will contain a fix.

答案2

得分: 0

If you really need the functionality of 3.6.2 release, one way would be to add copy command inside .csproj file. This is a temporary solution while you wait for the next Gremlin version.
This issue only seems to happen for local environment, so could write something like this:

<Target Name="CopyDependencies" AfterTargets="Build">
<Copy Condition="$(ASPNETCORE_ENVIRONMENT) == 'local'" SourceFiles="$(OutDir)Gremlin.Net.dll" DestinationFolder="$(ProjectDir)" SkipUnchangedFiles="false" />
</Target>

Note that you need to add the environment variable ASPNETCORE_ENVIRONMENT: local as well. The value you decide yourself, either it's local, development etc.

After that is done, add Gremlin.Net.dll file to the .gitignore, so that it is not tracked via source control.

英文:

If you really need the functionality of 3.6.2 release, one way would be to add copy command inside .csproj file. This is a temporary solution while you wait for the next Gremlin version.
This issue only seems to happen for local environment, so could write something like this:

<Target Name="CopyDependencies" AfterTargets="Build">
<Copy Condition="$(ASPNETCORE_ENVIRONMENT) == 'local'" SourceFiles="$(OutDir)Gremlin.Net.dll" DestinationFolder="$(ProjectDir)" SkipUnchangedFiles="false" />
</Target>

Note that you need to add the environment variable ASPNETCORE_ENVIRONMENT: local as well. The value you decide yourself, either it's local, development etc.

After that is done, add Gremlin.Net.dll file to the .gitignore, so that it is not tracked via source control.

huangapple
  • 本文由 发表于 2023年3月15日 21:16:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75745249.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定