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=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
and the web.config like that:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="MyBehaviour" name="MyNamespace.myservice">
<endpoint address="" behaviorConfiguration="RestBehaviour" binding="webHttpBinding" contract="namespace.ImyService"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehaviour">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="RestBehaviour">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
the code like that:
namespace MyNamespace
{
[ServiceContract]
public interface Imyservice
{
[OperationContract]
[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.