1

I have a Sharepoint solution with a WCF Service and a simple get method that returns a "Hello world". When making the request however, it doesn't return anything and I don't get any error either.

Any idea what could be causing this?

I am making the request in this form: http://myServer/_vti_bin/Service1.svc/helloworld

This is my web.config:

<?xml version="1.0"?>
<configuration>

<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<behavior name="Service1ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="jsonBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="BAServiceMap.Service1"  behaviorConfiguration="Service1ServiceBehavior">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="jsonBehavior" contract="BAServiceMap.IService1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<!--<protocolMapping>
    <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>-->    
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>

</configuration>
4
  • do you see the wsdl when you enter that url of the webservice in the browser?
    – Ola
    Commented Nov 10, 2016 at 14:24
  • yes, I see the wsdl
    – sallysway
    Commented Nov 10, 2016 at 14:51
  • Have a look at the article in my answer
    – HarryB
    Commented Nov 11, 2016 at 10:22
  • I created a new service using the MultipleBaseAddressWebServiceHostFactory and it works fine. Cheers :)
    – sallysway
    Commented Nov 11, 2016 at 12:14

1 Answer 1

1

Assuming that you are on SharePoint 2013- I had to create a custom WCF service as well and there is good guidance for doing that in this article

You will not need to rely on a web.config file for your service because in your .svc file the use of the SharePoint-specific MultipleBaseAddressWebServiceHostFactory replaces the need to specify endpoint configurations in a web.config.

For Example your .svc will look like this:

<%@ ServiceHost Language="C#" Debug="true"
    Service="Barkes.Services.Presidents.PresidentsService, $SharePoint.Project.AssemblyFullName$"
    CodeBehind="PresidentsService.svc.cs"
    Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory,
    Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral,
    PublicKeyToken=71e9bce111e9429c" %>

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.