0

I've created a simple custom WCF service in SharePoint.

enter image description here

ITicketingClientService.cs:

    using System.ServiceModel;

    namespace TicketingSystem.Core.ClientService
    {
        [ServiceContract]
        public interface ITicketingClientService
        {
                [OperationContract]
                string HelloWorld();
         }
    }

TicketingClientService.svc:

<%@ ServiceHost Language="C#" Debug="true"
    Service="TicketingSystem.Core.ClientService.TicketingClientService, TicketingSystem.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=522e648c9986f590"  
    CodeBehind="TicketingClientService.svc.cs"
    Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressBasicHttpBindingServiceHostFactory, 
    Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL %>

TicketingClientService.svc.cs:

using System.ServiceModel.Activation;
using Microsoft.SharePoint.Client.Services;

namespace TicketingSystem.Core.ClientService
{
    [BasicHttpBindingServiceMetadataExchangeEndpoint]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class TicketingClientService : ITicketingClientService
    {
        public string HelloWorld()
        {
            return "Hello World from WCF and SharePoint 2013";
        }

    }
}

It works: http://sharepointtest/_vti_bin/TicketingClientService/TicketingClientService.svc/mex?wsdl But now I want to connect to it from an AngularJS application, without exposing the rest of SharePoint to the public. Unfortunately, SharePoint is forcing me to authenticate with it via NTLM, unless the whole web application has anonymous access enabled (which I haven't tested yet.).

I get this error:

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

So, is there a way to host a web service within SharePoint to service requests to any user, authenticated or not, without that user having permissions on lists, libraries, etc... within SharePoint?

  • Why not host it in a different web application in IIS which has no relation to SharePoint? – Akhoy Sep 1 '15 at 15:51
  • I was thinking of that but I'd leave it as a plan b.. I'd rather have it in SharePoint, one less project, one less component to worry about – David Sep 1 '15 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.