title: Pass Parameters to AddHostedService
body: <p>I am writing a .Net Core windows service and here is a snippet of code:</p>
  <pre><code>internal static class Program
      {
          public static async Task Main(string[] args)
          {
              var isService = !(Debugger.IsAttached || args.Contains(&quot;--console&quot;));
  
              var builder = new HostBuilder()
                  .ConfigureServices((hostContext, services) =&gt;
                  {
                      services.AddHostedService&lt;IntegrationService&gt;();
                  });
  
              if (isService)
              {
                  await builder.RunAsServiceAsync();
              }
              else
              {
                  await builder.RunConsoleAsync();
              }
          }
      } 
  </code></pre>
  <p>I want to pass some parameters to my service i.e. <code>IntegrationService</code> - how I can send parameters to my service?</p>