log error as below. Which makes sense but how do I declear a IContentService so it works.
{"@t":"2021-04-15T13:00:13.8581004Z","@mt":"Failed to process the job '13': an exception occurred. Retry attempt 1 of 10 will be performed in 00:00:16.","@l":"Warning","@x":"System.InvalidCastException: Unable to cast object of type 'Umbraco.Web.UmbracoContext' to type 'Umbraco.Core.Services.IContentService'.\r\n at Cultiv.Hangfire.ScheduleHangfireJobs.ProductPriceUpdate(GuidUdi productUdi, IBDPrice Price) in D:\Web Development\Intelligence By Design 2021\IBDeCommerce\Helpers\IBDeCommerceDashboardHelpers.cs:line 172\r\n at Cultiv.Hangfire.ScheduleHangfireJobs.GetProductDetailsByXPath(IbdeCommerceProduct Product, IbdeCommerceBrand Brand) in D:\Web Development\Intelligence By Design 2021\IBDeCommerce\Helpers\IBDeCommerceDashboardHelpers.cs:line 167\r\n at Cultiv.Hangfire.ScheduleHangfireJobs.DoIt(PerformContext context, Int32 shopId, Int32 brandId) in D:\Web Development\Intelligence By Design 2021\IBDeCommerce\Helpers\IBDeCommerceDashboardHelpers.cs:line 108","SourceContext":"Hangfire.AutomaticRetryAttribute","ProcessId":31876,"ProcessName":"iisexpress","ThreadId":23,"AppDomainId":2,"AppDomainAppId":"LMW3SVC2ROOT","MachineName":"DESKTOP-DCF20OR","Log4NetLevel":"WARN "}
Using IContentService inside a UmbracoDefaultOwinStartup Hangfire scheduler
Note I are using umbraco 8.12.2.
I have successfully created a Hangfire scheduler that crawls another website for price information.
What I need to do now is store that information on the correct doctype page.
doctype is IBDeCommerce_Product can read these pages and get the old data using
I can load the new values into where I need them to go then I call the ProductPriceUpdate method to re publish the content.
I think Im half way to the answer but I need to access the IConentService correctly as this line is where everything falls over.
log error as below. Which makes sense but how do I declear a IContentService so it works.
{"@t":"2021-04-15T13:00:13.8581004Z","@mt":"Failed to process the job '13': an exception occurred. Retry attempt 1 of 10 will be performed in 00:00:16.","@l":"Warning","@x":"System.InvalidCastException: Unable to cast object of type 'Umbraco.Web.UmbracoContext' to type 'Umbraco.Core.Services.IContentService'.\r\n at Cultiv.Hangfire.ScheduleHangfireJobs.ProductPriceUpdate(GuidUdi productUdi, IBDPrice Price) in D:\Web Development\Intelligence By Design 2021\IBDeCommerce\Helpers\IBDeCommerceDashboardHelpers.cs:line 172\r\n at Cultiv.Hangfire.ScheduleHangfireJobs.GetProductDetailsByXPath(IbdeCommerceProduct Product, IbdeCommerceBrand Brand) in D:\Web Development\Intelligence By Design 2021\IBDeCommerce\Helpers\IBDeCommerceDashboardHelpers.cs:line 167\r\n at Cultiv.Hangfire.ScheduleHangfireJobs.DoIt(PerformContext context, Int32 shopId, Int32 brandId) in D:\Web Development\Intelligence By Design 2021\IBDeCommerce\Helpers\IBDeCommerceDashboardHelpers.cs:line 108","SourceContext":"Hangfire.AutomaticRetryAttribute","ProcessId":31876,"ProcessName":"iisexpress","ThreadId":23,"AppDomainId":2,"AppDomainAppId":"LMW3SVC2ROOT","MachineName":"DESKTOP-DCF20OR","Log4NetLevel":"WARN "}
Use Dependency resolver like this:
is working on a reply...