I'm trying to make a WCF Rest service inside SharePoint. but it doesn't work and I get 404 :(

I set the svc file like that

<%@ ServiceHost Language="C#" Debug="true"
Service="MyNamespace.myservice, $SharePoint.Project.AssemblyFullName$" 
Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=, Culture=neutral,  PublicKeyToken=71e9bce111e9429c" %>

and the web.config like that:

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <service behaviorConfiguration="MyBehaviour" name="MyNamespace.myservice">
            <endpoint address="" behaviorConfiguration="RestBehaviour" binding="webHttpBinding" contract="namespace.ImyService"></endpoint>
            <behavior name="MyBehaviour">
                <serviceMetadata httpGetEnabled="true"/>
            <behavior name="RestBehaviour">

the code like that:

namespace MyNamespace
    public interface Imyservice
        [WebGet(UriTemplate = "Work")]
        string Work();

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    class myservice : Imyservice
        public string Work()
          return ("Hi");

And nothing. When I'm trying to browse the service(.svc) or one of the methods, I get 404..

I should mention, I already managed to provide a Soap service at this same server.

please help me.

  • If I understood what you mean by "browse", I think that is just normal behavior. Try to actually call your method and see if it works as expected.
    – SPArcheon
    Jul 11, 2016 at 17:28
  • @SPArchaeologist I tried to call the method -> ...localhost/_vti_bin/Myservice.svc/Work, and it didn't work...
    – Shaked Bu
    Jul 11, 2016 at 17:29
  • Strange... your sample is very close to this one. I am doing the same (specifying 'MultipleBaseAddressWebServiceHostFactory' in the .svc file and WebGet on the service interface - no web.config manual modification needed) and I am able to consume my service both with JQuery $.ajax and Angularjs $http. Have you checked all the files have been correctly deployed to the ISAPI folder?
    – SPArcheon
    Jul 12, 2016 at 14:41
  • @SPArchaeologist you are right. I figured it out. I eventually checks the eventViewer and saw exceptions like "...more than one endpoints cofigured..." or something like that. I fixed that, and now it works :)
    – Shaked Bu
    Jul 15, 2016 at 5:17
  • actually... I think that you should be able to just use the factory with no "custom web.config" in the first place, but glad you have it figured out ^_^
    – SPArcheon
    Jul 17, 2016 at 17:53

1 Answer 1


I found out what the problem was. After checking the EventViewer (which is recommended) I found some exceptions related to my custom service service similar to "...more than one endpoints configured...". I therefore fixed my configuration by adding this:

<binding name="RestBinding">
    <security mode="None" />
</webHttpBinding >

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.