Closed
Description
following code fails with NullReferenceException
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
var path = Path.Combine(AppDomain.CurrentDomain.GetData("WWWBaseDirectory").ToString(),
"wwwroot\\videos"); ;
the reason is (my guess) the pipeline is not configured
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
AppDomain.CurrentDomain.SetData("WWWBaseDirectory", env.ContentRootPath);
Cause
services.AddHostedService<VideosWatcher>();
runs earlier