When i exclude the IPublisherQuery from the constructor, including only the IMediaService it run without issues? Wht might be the issue with injecting IPublisherQuery service on the composer and what is the solution?
this is a summary of the error im getting when starting umbraco
The short of it is IPublished ContentQuery relies on there being an Umbraco Context on the thread and 'inside a component' you are not guaranteed that there will be one...
There is a bit of documentation here that explains it:
IPublishedContentQuery Composer dependency injection error
public class WebPComponent: IComponent { private readonly IMediaService _mediaService; private readonly IPublishedContentQuery _publishedContentQuery; //private readonly IMediaTypeService _mediaTypeService;
When i exclude the IPublisherQuery from the constructor, including only the IMediaService it run without issues? Wht might be the issue with injecting IPublisherQuery service on the composer and what is the solution?
this is a summary of the error im getting when starting umbraco
Hi Khupi
The short of it is IPublished ContentQuery relies on there being an Umbraco Context on the thread and 'inside a component' you are not guaranteed that there will be one...
There is a bit of documentation here that explains it:
https://our.umbraco.com/Documentation/Implementation/Services/index-v8#accessing-core-services-and-helpers-when-there-is-no-umbracocontext-eg-in-a-component-or-c-class
And shows you how you can query the umbraco cache in this scenario
Regards
Marc
Thanks Marc. Ill check it out
is working on a reply...