Nservice总线端点命名 [英] Nservice Bus Endpoint Naming

查看:260
本文介绍了Nservice总线端点命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图去交手NSerivceBus,虽然它的主要进展顺利,我努力理解如何配置EndPointName。

I am trying to get to grips with NSerivceBus and although it's mostly going smoothly I am struggling to understand how to configure the EndPointName.

因此​​,举例来说,下面我设法想出以下,但任何企图使我改变端点名称失败的几个例子后。

So for example, after following a few examples I have managed to come up with the following but any attempt I make to change the EndPoint Name fails.

所以myServer上队列目前它被命名,取,我觉得从这里命名空间:

So the myServer queue is currently what it is named, taken, I think from the namespace here:

  namespace MyServer
{
    class EndPointConfig : IConfigureThisEndpoint, AsA_Server
    {
    }
}

但是当我把[EndpointName(AnotherQueue)没有什么变化(除非它不填写myServer上队列中。

But when i Put [EndpointName("AnotherQueue")] nothing changes (Except it doesnt fill the myServer queue.

我也试图改变在Global.asax:

I also tried to change the Global.ASAX:

public static IBus Bus { get; set; }
        void Application_Start(object sender, EventArgs e)
        {
            Bus = NServiceBus.Configure.With()
                .Log4Net()
                .DefaultBuilder()
                .DefineEndpointName("AnotherQueue")
                .XmlSerializer()
                .MsmqTransport()
                    .IsTransactional(false)
                    .PurgeOnStartup(false)
                .UnicastBus()
                    .ImpersonateSender(false)
                .CreateBus()
                .Start();
        }

但同样,它没有工作。

But again, it didnt work.

我通过观察MMC和检查消息队列有测试。

I am testing it by looking at mmc and checking the message queuing there.

最后我试图改变在web.config

Lastly I have tried altering the web.config

<configSections>
        <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NserviceBus.Core"/>
        <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/>
    </configSections>

    <MsmqTransportConfig ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5"/>

    <UnicastBusConfig>
        <MessageEndpointMappings>
            <add Messages="MyMessage" Endpoint="AnotherQueue"></add>
        </MessageEndpointMappings>
    </UnicastBusConfig>

和仍然一无所获。

有没有人能帮忙吗?我仍然在试图让我的头解决这个(这是一种新的技术给我),所以我apolagise如果我问这个问题知之甚少。

Is anyone able to help? I'm still trying to get my head around this (It's a new technology to me) so I apolagise if I have asked this question poorly.

在此先感谢
莱克斯

Thanks in advance Lex

推荐答案

两件事情:

我不是100%肯定,但我不认为你想使用IConfigureThisEndpoint,并AsA_Server如果你是在一个Web应用程序托管。我相信,在配置code你的Application_Start必须是你所需要的。配置的其他方式是,当你在NSB自己的过程主机(作为Windows服务或控制台)的。

I'm not 100% sure, but I don't think you want to use IConfigureThisEndpoint, and AsA_Server if you are hosting in a web application. I believe the configuration code you have in Application_Start is all you need. The other means of configuring is for when you host in the NSB's own process (as a windows service or console).

尝试把 DefineEndPointName(AnotherQueue)为后第一个命令NServiceBus.Configure.With()。这是我有它设置的方式和它的作品,我后()做的事相信命令的顺序,并能静默失败(我认为这将在未来的版本中得到解决)。

Try putting DefineEndPointName("AnotherQueue") as the first command after NServiceBus.Configure.With(). This is the way I have it setup and it works, and I believe the order of the commands after With() do matter, and can fail silently (I think this will be addressed in a future release).

根据您所要完成什么,你可能不需要unicastbus配置的。这是用来定义的客户端的端点的一面 - 换句话说,用它来定义你的应用程序想跟端点

Depending on what you are trying to accomplish, you may not need the unicastbus config at all. That is used to define endpoints on the client side--in other words, use it to define endpoints your app wants to talk to.

最后,当你运行它,找到什么可能会错误的线索使用你的Web应用程序的调试窗口。 NSB产生大量的在调试模式下非常有用的日志记录的信息,所有这些都应该被发送到调试窗口。这可能是您的应用程序没有权限创建队列,或类似的规定。一旦我该位了,排除了大量的学习曲线问题成为更容易。

Finally, use the debug window of your web app as you run it to find clues about what may be going wrong. NSB produces a lot of very useful logging information in debug mode, all of which should be sent to the debug window. It may be that your app doesn't have permissions to create the queue, or something along those lines. Once I figured that bit out, troubleshooting a lot of the "learning curve problems" became much easier.

这篇关于Nservice总线端点命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆