Skip to content

Background Service to early up and running #12501

Closed
@hannespreishuber

Description

@hannespreishuber

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-hostingIncludes Hostingarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions