Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nservicebus Web应用已订阅事件,但未处理它们_Nservicebus - Fatal编程技术网

Nservicebus Web应用已订阅事件,但未处理它们

Nservicebus Web应用已订阅事件,但未处理它们,nservicebus,Nservicebus,我的web进程向域发送命令并处理事件(将信号器推送到浏览器)。它在IIS Express/Win7 x64上运行ASP.NET MVC3和.NET 4 它随机地,有时从一开始就决定停止将事件分发给我的处理程序。这些事件位于web端点的日志队列中,但没有其他事件跟踪。日志中完全没有这些断点,处理程序中的断点从未命中,端点和错误队列都为空 Func<Type, bool> isMessage = t => typeof(IMessage).IsAssignableF

我的web进程向域发送命令并处理事件(将信号器推送到浏览器)。它在IIS Express/Win7 x64上运行ASP.NET MVC3和.NET 4

它随机地,有时从一开始就决定停止将事件分发给我的处理程序。这些事件位于web端点的日志队列中,但没有其他事件跟踪。日志中完全没有这些断点,处理程序中的断点从未命中,端点和错误队列都为空

        Func<Type, bool> isMessage = t => typeof(IMessage).IsAssignableFrom(t);
        Func<Type, bool> isCommand = t => typeof(ICommand).IsAssignableFrom(t);
        Func<Type, bool> isEvent = t => typeof(IEvent).IsAssignableFrom(t);


        Configure.WithWeb()
            .NinjectBuilder(Kernel)
            .DefineEndpointName("Hospital.Web")
            .DefiningMessagesAs(isMessage)
            .DefiningCommandsAs(isCommand)
            .DefiningEventsAs(isEvent)
            .Log4Net()
            .JsonSerializer()
            .MsmqTransport()
            .UnicastBus()
            .LoadMessageHandlers()
            .PurgeOnStartup(true)
            .CreateBus()
            .Start();
Func isMessage=t=>typeof(IMessage).IsAssignableFrom(t);
Func isCommand=t=>typeof(ICommand).IsAssignableFrom(t);
Func isEvent=t=>typeof(IEvent).IsAssignableFrom(t);
Configure.WithWeb()
.NinjectBuilder(内核)
.DefineEndpointName(“Hospital.Web”)
.DefiningMessagesAs(isMessage)
.定义命令SAS(isCommand)
.定义事件(isEvent)
.Log4Net()
.JsonSerializer()
.MsmqTransport()
.UnicastBus()
.LoadMessageHandlers()
.PurgeOnStartup(正确)
.CreateBus()
.Start();
以下是my web.config的NSB部分:

<MsmqTransportConfig ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
   <MessageEndpointMappings>
      <add Messages="Hospital.Commands" Endpoint="Hospital.CommandHandlers" />
      <add Messages="Hospital.Events" Endpoint="Hospital.CommandHandlers" />
   </MessageEndpointMappings>
</UnicastBusConfig>


. 该邮件附带了一个日志文件。

RC4中有一个bug可能导致此行为,您可以试试RC5,看看是否有帮助吗?

谢谢Andreas。我今晚就试试看。
public class StatsHandler :
    IHandleMessages<PatientAdmitted>,
    IHandleMessages<BedAssigned>,
    IHandleMessages<PatientDischarged>
{

    private static readonly ILog Log = LogManager.GetLogger(typeof (StatsHandler));

    private readonly IConnectionManager _connectionManager;

    public StatsHandler(IConnectionManager connectionManager)
    {
        _connectionManager = connectionManager;
    }

    protected dynamic Clients
    {
        get { return _connectionManager.GetClients<StatsHub>(); }
    }


    public void Handle(PatientAdmitted message)
    {
        Log.DebugFormat("Admitted {0} {1}", message.FirstName, message.LastName);
        Clients.patientAdmitted();
    }

    public void Handle(BedAssigned message)
    {
        Log.DebugFormat("Assigned {0} to {1}", message.PatientId, message.Bed);
        Clients.bedAssigned();
    }

    public void Handle(PatientDischarged message)
    {
        Log.DebugFormat("Discharged {0}", message.PatientId);
        Clients.patientDischarged();
    }
}