0

我已经使用 EventProcessorHost 来监听天蓝色的事件中心。我在带有事件中心配置的 RegisterEventProcessorAsync 类中创建了一个异步方法。并在我的 Startup.cs 类中使用此异步方法。它在本地运行良好,但在 Azure 上部署时却无法运行。这是我注册事件中心和 startup.cs 类的方法。

    public static class ProcesssRTS
{
    private static string EhConnectionString =""
    private static string EhEntityPath =""
    private static string StorageContainerName =""
    private static string StorageAccountName =""
    private static string StorageAccountKey =""

    private static readonly string StorageConnectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", StorageAccountName, StorageAccountKey);

    public static async Task MainAsync()
    {
        Console.WriteLine("Registering EventProcessor...");

        var eventProcessorHost = new EventProcessorHost(
            EhEntityPath,
            PartitionReceiver.DefaultConsumerGroupName,
            EhConnectionString,
            StorageConnectionString,
            StorageContainerName);

        await eventProcessorHost.RegisterEventProcessorAsync<RTSEventProcessor>();

        Console.WriteLine("Receiving. Press ENTER to stop worker.");
        Console.ReadLine();
        await eventProcessorHost.UnregisterEventProcessorAsync();
    }
}

 public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        ProcesssRTS.MainAsync();
        app.Map("/signalr", map =>
        {
            map.UseCors(CorsOptions.AllowAll);
            var hubConfiguration = new HubConfiguration { };
            map.RunSignalR(hubConfiguration);
        });

    }
}
4

0 回答 0