Url = '((Umbraco.Web.Models.PublishedContentBase)typedContent).Url' threw an exception of type 'System.InvalidOperationException'
I have a REST API which works just as expected as long as I first visit a page after an application recycle.
If I recycle the application and hit the API first I get an exception when trying to access the Url property on a IPublishedContent.
Url = '((Umbraco.Web.Models.PublishedContentBase)typedContent).Url' threw an exception of type 'System.InvalidOperationException'
I load the content with _umbracoHelper.TypedContent(contentId) and instantiate _umbracoContext with the following code:
var umbracoContext = UmbracoContext.Current;
if (umbracoContext == null)
{
var httpContext = new HttpContextWrapper(HttpContext.Current);
UmbracoContext.EnsureContext(
httpContext,
ApplicationContext.Current,
new WebSecurity(httpContext, ApplicationContext.Current),
UmbracoConfig.For.UmbracoSettings(),
UrlProviderResolver.Current.Providers,
false);
}
_umbracoHelper = new UmbracoHelper(umbracoContext);
Url = '((Umbraco.Web.Models.PublishedContentBase)typedContent).Url' threw an exception of type 'System.InvalidOperationException'
I have a REST API which works just as expected as long as I first visit a page after an application recycle.
If I recycle the application and hit the API first I get an exception when trying to access the Url property on a IPublishedContent.
I load the content with _umbracoHelper.TypedContent(contentId) and instantiate _umbracoContext with the following code:
What am I missing?
is working on a reply...