Sorry about the posting in serveral forums - I totally missed this one yesterday...
I'm trying to host a custom wcf-service within my umbraco 4.7.2 site. I'm running into problems using uQuery within the service. It seems that uQuery lacks context information about the content tree resulting in Null Reference Exceptions. For instance uQuery.GetRootNode() generates an exception as well as uQuery.GetNodesByType.
The code works like a charm if the request comes from a page within the umbraco content tree.
Using uQuery from Custom WCF-service
Hi!
Sorry about the posting in serveral forums - I totally missed this one yesterday...
I'm trying to host a custom wcf-service within my umbraco 4.7.2 site. I'm running into problems using uQuery within the service. It seems that uQuery lacks context information about the content tree resulting in Null Reference Exceptions. For instance uQuery.GetRootNode() generates an exception as well as uQuery.GetNodesByType.
The code works like a charm if the request comes from a page within the umbraco content tree.
Grateful from pointers in the right direction :)
/Martin
Problem solved!
You have to use AspNetCompatibility mode. All you have to do is to add this to your system.ServiceModel-section:
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
and tag your service with this:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
/Martin
Cool, glad you solved it... as I was scratching my head with this one!
Cheers, Lee.
is working on a reply...