部署到Azure时未调用MessageHandlers

时间:2016-04-13 12:20:05

标签: c# azure rebus

我有一个应用程序,它使用Rebus库通过Azure ServiceBus接收消息。

与在本地运行应用程序时相比,当应用程序在Azure上作为Web应用程序运行时,我观察到了不同的行为。

当它在Azure中运行时,我的消息处理程序不会被调用。 当应用程序在本地运行时,一切都按预期工作。

这是我的设置。

在我的网站项目Portal中,Global.asax.cs:

    protected void Application_Start()
    {
        _webContainer = new WindsorContainer();
        _queueContainer = new WindsorContainer();
        ConfigureWebContainer();
        _queueContainer.Install(FromAssembly.Containing<ServiceBusInstaller>());

        ApplicationInsightsConfig.Configure();
    }

在ServiceBus项目中(ServiceBusInstaller所在的位置)

public void Install(IWindsorContainer container, IConfigurationStore store)
{
    var adapter = new CastleWindsorContainerAdapter(container);
    var connectionString = CloudConfigurationManager.GetSetting("QueueUrl");

    var configurer = Configure
    .With(adapter)
    .Options(o =>
    {
        o.SimpleRetryStrategy(maxDeliveryAttempts: 0);
    })
    .Logging(l => l.Log4Net())
    .Routing(r => r.TypeBased()
        .MapAssemblyOf<ResetPasswordMessage>("Email"))
    Transport(t => t.UseAzureServiceBus(connectionString, "Email"));
    // Create and starts the bus
    configurer.Start();
}

我的ResetPasswordHandler看起来像这样:

public class ResetPasswordHandler : IHandleMessages<ResetPasswordMessage>
{
    private readonly IContactAndEmailService _contactAndEmailService;

    public ResetPasswordHandler(IContactAndEmailService contactAndEmailService)
    {
        _contactAndEmailService = contactAndEmailService;
    }

    public async Task Handle(ResetPasswordMessage message)
    {
        _contactAndEmailService.SendEmail(message);
    }
}

我正在使用Service Bus Explorer连接到服务总线,我可以看到该消息在&#34; email&#34;队列。然而它确实存在,因此不被消耗。

任何有关设置或天蓝色订阅限制的指针或其他可以帮助我前进的内容都受到高度赞赏。

1 个答案:

答案 0 :(得分:1)

我认为它可能与队列名称#ctaButton { position: absolute; margin: auto; left: 26%; top: 70%; padding: 10px; background: #CCC; background-color: rgba(255, 131, 15, 0.5); } .animate-fadeButton { -webkit-animation: fadeButton 15s infinite; -moz-animation: fadeButton 15s infinite; -o-animation: fadeButton 15s infinite; animation: fadeButton 15s infinite; } @keyframes fadeButton { 0% { opacity: 0; } 25% { opacity: 0; } 35% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } animation-timing-function: linear; } @-o-keyframes fadeButton { 0% { opacity: 0; } 25% { opacity: 0; } 35% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } animation-timing-function: linear; } @-moz-keyframes fadeButton { 0% { opacity: 0; } 25% { opacity: 0; } 35% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } animation-timing-function: linear; } @-webkit-keyframes fadeButton { 0% { opacity: 0; } 25% { opacity: 0; } 35% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } -webkit-animation-timing-function: linear; } 的外壳有关。

你可以试着让它整个小写吗?