You can create your own fake umbracocontext and use that if you need it
var httpContext = new HttpContextWrapper(HttpContext.Current ?? new HttpContext(new SimpleWorkerRequest("temp.aspx", "", new StringWriter())));
var umbContext = UmbracoContext.EnsureContext(
httpContext,
ApplicationContext.Current,
new WebSecurity(httpContext, ApplicationContext.Current),
UmbracoConfig.For.UmbracoSettings(),
UrlProviderResolver.Current.Providers,
false);
PageCacheRefresher and MessageType.RefreshById no longer works with UmbracoContext.Current V7.12.3
I've been trying to hook into the Distributed call events using
and then using
But UmbracoContext.Current is always null when this gets hits in the Slave machine. Has this been changed in the new version of Umbraco V7.12.3?
I remember it used to work before in an older version
Thanks
Been digging around, used to work like in this example to call ContentCache https://github.com/Shazwazza/Articulate/blob/master/src/Articulate/UmbracoEventHandler.cs#L115
The call is initiated via a scheduled task (AFAIK), and you can't be sure that the umbraco context is available, when there is no webrequest involved.
Take a look at https://github.com/Shazwazza/Articulate/blob/master/src/Articulate/UmbracoEventHandler.cs#L109 ;)
This is due to this breaking change in v7.8.0+ https://issues.umbraco.org/issue/U4-10150
Thanks Jeavon. No wonder
Hi,
You can create your own fake umbracocontext and use that if you need it
Dave
Thanks Dave, will try that out
Seems to work. Thanks Dave
is working on a reply...