// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostingPort hostingPort) { var port = int.Parse(app.ServerFeatures.Get <IServerAddressesFeature>().Addresses.First(x => x.StartsWith("http://", StringComparison.OrdinalIgnoreCase)).Split(":").Last()); hostingPort.Port = port; if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //app.UseHttpsRedirection(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public DiscoverBackgroundService(ILogger <DiscoverBackgroundService> logger, IHostingPort hostingPort, IOptions <JsonOptions> options) { this.logger = logger; this.hostingPort = hostingPort; this.jsonSerializerOptions = options.Value.JsonSerializerOptions; }