title: .net core web app and reading data from azure event hub
body: <p>I am trying to receive data from Azure Event Hub and display them on .NET core 2.1 Web App using signalR. I have follow this tutorial <a href="https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-dotnet-standard-getstarted-receive-eph" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-dotnet-standard-getstarted-receive-eph</a> and everything works on .net core console app. But I have stuck on how to implement this in web app. I am still new in web app so maybe my problem is trivial.
  Here is main web app code</p>
  
  <pre><code>        public static void Main(string[] args)
      {
  
          CreateWebHostBuilder(args).Build().Run();
      }
  
      public static IWebHostBuilder CreateWebHostBuilder(string[] args) =&gt;
          WebHost.CreateDefaultBuilder(args)
              .UseStartup&lt;Startup&gt;();
  </code></pre>
  
  <p>And part of code from tutorial which is responsible for deploying event processor is in MainAsync(string[] args)</p>
  
  <pre><code>        private static async Task MainAsync(string[] args)
      {
          Console.WriteLine("Registering EventProcessor...");
          var eventProcessorHost = new EventProcessorHost(
              EventHubName,
              PartitionReceiver.DefaultConsumerGroupName,
              EventHubConnectionString,
              StorageConnectionString,
              StorageContainerName);
  
          // Registers the Event Processor Host and starts receiving messages
          await eventProcessorHost.RegisterEventProcessorAsync&lt;SimpleEventProcessor&gt;();
  
          Console.WriteLine("Receiving. Press ENTER to stop worker.");
          Console.ReadLine();
  
          // Disposes of the Event Processor Host
          await eventProcessorHost.UnregisterEventProcessorAsync();
      }
  </code></pre>
  
  <p>Here is my problem. How to run MainAsync and run web app? If I do something like this </p>
  
  <pre><code>        public static void Main(string[] args)
      {
          MainAsync(args);
          CreateWebHostBuilder(args).Build().Run();
  
      }
  </code></pre>
  
  <p>Everything compiles but nothing happens when there is new event in event hub, and I don't know why and how to solve this problem</p>