Copied to clipboard

Flag this post as spam?

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


  • Melvin Chew 10 posts 89 karma points
    Oct 11, 2017 @ 06:55
    Melvin Chew
    0

    WCF service in Umbraco

    Hi Guys,

    I created a wcf service in my Umbraco Project. In the wcf service i added the following:

        [OperationContract]
    
        [WebGet(UriTemplate = "/RAEvents/GetAllEvents", ResponseFormat = WebMessageFormat.Json)]
    
        List<WCFEvent> GetAllEvents();
    

    and i tried calling the wcf service on my web browser using :

        https://{ipaddress}/ra2/RAService.svc/RAEvents/GetAllEvents
    

    but i got a response :

    No umbraco document matches the url '/ra2/RAService.svc/RAEvents/GetAllEvents'.
    

    However when i run the following service on the browser, they indicated that the service has been created.

                   https://{ipaddress}/ra2/RAService.svc
    

    I'm trying to create a custom wcf service to return json objects. Is this way not a possible way to use wcf service to return json with umbraco?

  • Nik 1413 posts 6212 karma points MVP 3x c-trib
    Oct 11, 2017 @ 08:35
    Nik
    0

    Hi Melvin,

    You will need to add /ra2 to the reserved paths app setting in web config. This should allow you to get access to any urls that start /ra2 instead of Umbraco's routing engine intercepting it.

    Thanks,

    Nik

  • Melvin Chew 10 posts 89 karma points
    Oct 11, 2017 @ 09:23
    Melvin Chew
    0

    Thank you Nik for your response.

    I have tried what you said and have added the following in my web config:

     <add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/RAService.svc,~/ra2" />
    

    however i still got this error:

    Server Error in '/ra2' Application.
    
     The resource cannot be found.
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies