带有NServiceBus的Storyteller.NET无法启动端点实例

时间:2018-01-26 10:14:19

标签: .net nservicebus appdomain

我使用Storyteller csproj runner设置了StoryTeller,所以从我的项目文件夹中运行这种脚本来打开StoryTeller Web应用程序:

"..\..\packages\StorytellerRunnerCsproj.4.2.0\tools\StorytellerRunner.exe" open "..\..\MyTestProject" --culture en-US --app-domain
pause

Storyteller将浏览我项目中的类型并将它们加载到一个单独的AppDomain中(根据--app-domain选项),就像许多测试框架一样。

我遇到的问题是我想在我的测试中通过NServiceBus发送消息。为了做到这一点,我首先必须启动一个NServiceBus端点,如下所示:

var endpointInstance = await Endpoint.Start(endpointConfiguration);

虽然具有给定端点配置的上述代码在普通控制台应用程序上运行正常,但在Storyteller中运行它时会出现以下错误:

System.AggregateException: One or more errors occurred. ---> System.Exception: Can't find any behaviors/connectors for t
he root context (NServiceBus.Pipeline.ITransportReceiveContext)
   at NServiceBus.PipelineModelBuilder.Build()
   at N
ServiceBus.StepRegistrationsCoordinator.BuildPipelineModelFor[TRootContext]()
   at NServiceBus.Pipeline`1..ctor(IBuild
er builder, ReadOnlySettings settings, PipelineModifications pipelineModifications)
   at NServiceBus.StartableEndpoint
.<Start>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runt
ime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.Handle
NonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.Endpoint.<Start>d__1.MoveNext()
--- End of stack trace
from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSucc
ess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at QPark.Cloud.Testi
ng.Shared.Messaging.MessageService.<StartEndpointAsync>d__5.MoveNext() in C:\tfs\git\Repos\SystemTests\QPark.Cloud.Syste
mTests\QPark.Cloud.Testing.Shared\Messaging\MessageService.cs:line 49
--- End of stack trace from previous location whe
re exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Syst
em.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.Compile
rServices.TaskAwaiter`1.GetResult()

我怀疑这与Storyteller在另一个AppDomain中加载此代码的事实有关,并且不知何故这会破坏NServiceBus ......

0 个答案:

没有答案