Try Now
More in this section

Forums / Developing with Sitefinity / Exposing a custom .svc stored in /Sitefinty/Services

Exposing a custom .svc stored in /Sitefinty/Services

4 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    03 Dec 2008
    29 Aug 2012
    Link to this post
    Is it at all possible to expose a .svc file that I made living in /Sitefinity/Services?

    I've tried combinations in the web.config with the location tag, but nothing seems to work...

    <location path="Sitefinity/Services/X/X.svc">
                <allow users="*" />

    When I'm not authenticated it throws

    HTTP Error 401.0 - Unauthorized

    You do not have permission to view this directory or page.

    ...when I want to allow anon users access
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    18 Jul 2012
    29 Aug 2012
    Link to this post
    I could be totally wrong about this, but I believe you need to register the service using ObjectFactory with something like:

    ObjectFactory.RegisterWebService(typeof(MyService), "Sitefinity/Services/MyServices/MyService.svc");

    If this is for a custom module you'd do this in the Initialize() method. Otherwise you'd need to do it on App_Start in Global.asax.

    But again, this is just my assumption based on how the other modules are registered... hope this is helpful!
  3. Steve
    Steve avatar
    3037 posts
    03 Dec 2008
    29 Aug 2012
    Link to this post
    Well I mean the service WORKS...when I'm logged in, but not at all for anon, wont let me to that url b/c it's blocked behind /Sitefinity/

    Registering it makes it public?
  4. Georgi
    Georgi avatar
    3583 posts
    28 Oct 2016
    06 Sep 2012
    Link to this post
    Hello Steve,

    Yeah, this directory is protected for security reasons. If you want to expose a custom service, you should place the service here:


    If you want to store it in the protected services folder, I'd suggest you using 

    SystemManager.RegisterWebService(serviceType, appRelativeUrl);

    ..somewhere on the application start. 

    Hope this helps. 

    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
4 posts, 0 answered