Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carl Sjöholm 44 posts 327 karma points
    Dec 16, 2021 @ 13:25
    Carl Sjöholm
    0

    UmbracoHelper/UmbracoContext/PublishedContentQuery in Service for a HangfireTask

    Hi,

    I have an issue with a HangfireTask, I cannot resolve IUmbracoHelper or IPublishedContentQuery.

    Exception "Wasn't able to get an UmbracoContext".

    Tried IUmbracoHelperAccessor and IPublishedContentQueryAccessor but it returns null when TryGetValue.

    I need to get the published content item and it's url.

    Anyone have any ideas?

  • Carl Sjöholm 44 posts 327 karma points
    Dec 16, 2021 @ 13:26
    Carl Sjöholm
    0

    IUmbracoContextFactory returns a fake context for a HangfireTask and returns null when trying to find content by xpath.

  • Carl Sjöholm 44 posts 327 karma points
    Jan 05, 2022 @ 07:43
    Carl Sjöholm
    0

    Trying with a Umbraco Background task does the same thing. It's out of umbraco context somehow.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies