Copied to clipboard

Flag this post as spam?

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


  • Sai Raj R 11 posts 81 karma points
    May 25, 2016 @ 13:34
    Sai Raj R
    0

    WCF Rest Service not working in Umbraco

    Hi All,

    I am facing an issue while creating WCF Rest Service in the Umbraco Web Project and Hosted in IIS.

    IIS Hosting :

    Rest Url : "http://localhost:8016/WCFService.svc/getproducts"
    
    The rest service is not getting hit in the debug mode.
    

    WCF Self-hosting Mode :

    The Same code is giving the output when hosting it as "WCF Self-hosting Mode ".

    Output :

    {"UUProductsResult":[{"ProductID":1,"ProductName":"Demo Product 1"},{"ProductID":2,"ProductName":"Demo Product 2"}]}
    

    WCF code :

    [ServiceContract]
        public interface IWCFService
        {
    
            [WebInvoke(Method = "Get", ResponseFormat = WebMessageFormat.Json, UriTemplate = "/getproducts/")]
            [OperationContract]
            IEnumerable<Product> GetProducts();
    
        }
    
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        public class WCFService : IWCFService
        {
    
            public  IEnumerable<Product> GetProducts()
            {
                return new List<Product>() { 
                    new Product(){ProductID=1, ProductName="Demo Product 1"},
                    new Product(){ProductID=2, ProductName="Demo Product 2"}
                };
            }
    }
    

    configuration :

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

    Is there any configuration missing for Setting up the WCF Rest Service in Umbraco

  • Dallas 133 posts 405 karma points
    May 25, 2016 @ 14:23
    Dallas
    0

    Hi

    What do you get when accessing the url? Is it a 404?

    Dallas

  • 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