System.ArgumentException:通过Hangfire任务

时间:2018-06-07 06:13:37

标签: c# .net rabbitmq nservicebus hangfire

当我尝试通过Hangfire任务调用NServiceBus / Rabbit MQ时,我收到以下错误 我尝试将.NET Framework版本从4.5.2更新到4.6.1

不确定我在这里做错了什么? 我一直收到这个错误 但是,当我在本地运行(通过测试项目)时,消息成功放置在服务总线上(能够在服务端点上看到它)

    System.AggregateException
One or more errors occurred.

System.AggregateException: One or more errors occurred. ---> System.ArgumentException: The path is not of a legal form.
   at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at System.IO.Path.GetFullPath(String path)
   at System.Diagnostics.FileVersionInfo.GetFullPathWithAssert(String fileName)
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
   at NServiceBus.Transport.RabbitMQ.ConnectionConfiguration.Create(String connectionString, String endpointName) in C:\BuildAgent\work\a9e6741f41af7061\src\NServiceBus.RabbitMQ\Configuration\ConnectionConfiguration.cs:line 141
   at NServiceBus.Transport.RabbitMQ.RabbitMQTransportInfrastructure..ctor(SettingsHolder settings, String connectionString) in C:\BuildAgent\work\a9e6741f41af7061\src\NServiceBus.RabbitMQ\RabbitMQTransportInfrastructure.cs:line 29
   at NServiceBus.RabbitMQTransport.Initialize(SettingsHolder settings, String connectionString) in C:\BuildAgent\work\a9e6741f41af7061\src\NServiceBus.RabbitMQ\RabbitMQTransport.cs:line 18
   at NServiceBus.InitializableEndpoint.<Initialize>d__1.MoveNext() in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\InitializableEndpoint.cs:line 49
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.Endpoint.<Start>d__1.MoveNext() in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Endpoint.cs:line 27
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ERM.Messaging.ServiceBus.Client.ServiceBusClient.<StartAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at MeterServiceRequest.SyncMeterServiceRequest.<RunAsync>d__1.MoveNext()
   --- End of inner exception stack trace ---
   at MeterServiceRequest.SyncMeterServiceRequest.<RunAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at ERM.TaskRunner.Server.Impl.TaskWrapper.<RunAsync>d__0.MoveNext() in C:\Code\EMSCore\Apps\TaskRunner\TaskRunner.Server\Impl\TaskWrapper.cs:line 29
---> (Inner Exception #0) System.ArgumentException: The path is not of a legal form.
   at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at System.IO.Path.GetFullPath(String path)
   at System.Diagnostics.FileVersionInfo.GetFullPathWithAssert(String fileName)
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
   at NServiceBus.Transport.RabbitMQ.ConnectionConfiguration.Create(String connectionString, String endpointName) in C:\BuildAgent\work\a9e6741f41af7061\src\NServiceBus.RabbitMQ\Configuration\ConnectionConfiguration.cs:line 141
   at NServiceBus.Transport.RabbitMQ.RabbitMQTransportInfrastructure..ctor(SettingsHolder settings, String connectionString) in C:\BuildAgent\work\a9e6741f41af7061\src\NServiceBus.RabbitMQ\RabbitMQTransportInfrastructure.cs:line 29
   at NServiceBus.RabbitMQTransport.Initialize(SettingsHolder settings, String connectionString) in C:\BuildAgent\work\a9e6741f41af7061\src\NServiceBus.RabbitMQ\RabbitMQTransport.cs:line 18
   at NServiceBus.InitializableEndpoint.<Initialize>d__1.MoveNext() in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\InitializableEndpoint.cs:line 49
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.Endpoint.<Start>d__1.MoveNext() in C:\BuildAgent\work\b549d46003942065\src\NServiceBus.Core\Endpoint.cs:line 27
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ERM.Messaging.ServiceBus.Client.ServiceBusClient.<StartAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

1 个答案:

答案 0 :(得分:1)

我们通过将NService Bus文件(包括DLL)放在Hangfire任务所在的同一服务器上解决了这个问题,并在Hangfire任务解决方案中添加对NService Bus的引用