Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin 11 posts 33 karma points
    Sep 07, 2012 @ 08:59
    Martin
    0

    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

  • Martin 11 posts 33 karma points
    Sep 07, 2012 @ 09:28
    Martin
    0

    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

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Sep 07, 2012 @ 10:18
    Lee Kelleher
    0

    Cool, glad you solved it... as I was scratching my head with this one!

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft