【发布时间】:2015-09-12 23:05:08
【问题描述】:
我正在尝试在 ASP.NET 5 Web 应用程序中使用 NServiceBus。在调用 IBus.Send(purchaseTransactionAddedEvent) 时,其中 purchaseTransactionAddedEvent 的类型为 PurchaseTransactionAddedEvent 在另一个名为 Infrastructure.Contract 的程序集中定义,我收到此错误:
Message=找不到元数据 'Infrastructure.Contract.Events.PurchaseTransactionAddedEvent'。请 确保以下几点: 1. 'Infrastructure.Contract.Events.PurchaseTransactionAddedEvent' 包含在初始扫描中。 2.“Infrastructure.Contract.Events.PurchaseTransactionAddedEvent”实现“IMessage”、“IEvent”或“ICommand”,或者, 如果你不想实现一个接口,你可以使用'Unobtrusive 模式'。源=NServiceBus.Core
如下配置端点时,我使用的是不显眼模式:
busConfiguration.UseTransport<AzureServiceBusTransport>();
// we are using In memory persistence for messages
busConfiguration.UsePersistence<InMemoryPersistence>();
// NOTE: this is important and has to be set on publisher and subscriber endpoints.
// We are using unobstrusive mode, so our messages/events do not have to implement IMessage, IEvent, etc
var conventionsBuilder = busConfiguration.Conventions();
conventionsBuilder.DefiningEventsAs(t => t.Namespace != null && t.Namespace == "Infrastructure.Contract.Events");
但这似乎不适用于新的 ASP.NET 5 文件夹排列。
已在 NServiceBus 上启用了日志记录,但它没有告诉我它正在扫描哪些程序集。鉴于 ASP.NET 5 不再有 bin 文件夹,如何解决此问题?
【问题讨论】:
标签: c# asp.net .net nservicebus