Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Here is my problem:

Does anybody know how to configure a WCF service hosted in Sharepoint to show standard WCF welcome page (the one with description and a link to wsdl)?

I want to underline that I have dug through almost any available tutorial for this, including MSDN ones and I am able to call service methods normally. It just drives me crazy that it doesn't behave as it should and instead of showing me the forementioned welcome page (while browsing http://localhost/_vti_bin/MyService.svc) it says "Endpoint not found".

Once more: my service methods work OK, when I browse http://localhost/_vti_bin/MyService.svc/MyMethod I receive the expected results.

My question is: why am I not able to get the normal WCF welcome page when browsing http://localhost/_vti_bin/MyService.svc and the only info I get is "Endpoint not found" ?


This is my contract:

[ServiceContract(Namespace="SharepointPublisher")]
    public interface ISharepointPublisherService
    {
        [OperationContract]
        [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
        IList<SharepointListData> GetSharepointLists();

        [OperationContract]
        [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
        IList<EventReceiverData> GetEventReceiversForList(Guid listId);
    }


This is my service:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required),
    BasicHttpBindingServiceMetadataExchangeEndpoint,
    ServiceBehavior(AddressFilterMode = AddressFilterMode.Any, IncludeExceptionDetailInFaults = true)]
    public class SharepointPublisherServiceProxy : ISharepointPublisherService
    {
        [ServiceKnownType(typeof(IList<SharepointListData>))]
        public IList<SharepointListData> GetSharepointLists()
        {
            throw new NotImplementedException();
        }

        public IList<EventReceiverData> GetEventReceiversForList(Guid listId)
        {
            throw new NotImplementedException();
        }
    }

My config:

<bindings>
      <webHttpBinding>
        <binding name="customWebHttpBinding" maxReceivedMessageSize="100000000" maxBufferSize="100000000"
                  maxBufferPoolSize="100000000">
          <security mode="TransportCredentialOnly">
              <transport clientCredentialType="Ntlm"/>
          </security>
        </binding>
      </webHttpBinding>
    </bindings>

And finally my svc:

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


Additional info:

  • I am working on Sharepoint 2010 Foundation hosted on Windows Server 2008 R2 which is a domain controller (easy, it is just a VM, I am sane enough not to do such a thing on a real DC:)),

  • I have enabled anonymous authentication for Sharepoint site in IIS ,

  • I have placed it in the mapped ISAPI directory (svc and web.config),

  • I have edited Microsoft.VisualStudio.SharePoint.targets file and added svc extension in TokenReplacementFileExtensions section,

  • Situation is repeatable for TransportCredentialOnly None, Ntlm and also for security mode set to None,

  • I am using a factory for building and configuring the service so adding endpoint config sections to web.config results in exceptions and makes no sense,

  • Yes I have thought about creating a custom factory inheriting from one of the three available but is it really necessary to achieve such a simple goal ?


I have used Reflector to debug a little bit more than just my source files because "No endpoint found" is a very terse description: the resulting exception (for TransportCredentialOnly security mode and clientCredentialType set to ntlm) is

The incoming HTTP request's URI 'http://localhost/_vti_bin/sharepointpublisherserviceproxy.svc/ntlm' does not match any service operation.

for security mode set to None the URI in the exception is naturally different:

The incoming HTTP request's URI 'http://localhost/_vti_bin/sharepointpublisherserviceproxy.svc/anonymous/' does not match any service operation.

That is not all because the exception cited above is the last one I receive. I also receive ArgumentException in Microsoft.Sharepoint.ApplicationRuntime.SPRequestModule.IsExcludedPath. The IsExcludedPath method throws ArgumentException if virtual path is null or starts with ~. This is a known problem but from what I have googled it refered to Sharepoint 2007 not 2010. The solution for 2007 was to create a custom VirtualPathProvider but I don't think it applies to 2010. Besides, I don't know if this is the source of "Endpoint not found"

I am happy to provide any additional information on request if needed

share|improve this question
    
I have seen this problem, too. Even if endpoint was "not found", I could use this to call ajax functions from javascript code. –  Anatoly Mironov Sep 14 '12 at 9:27
1  
Yes I know, I am also able to call functions but why can't I see the standard page? I hate things half-or-three-qaurters-working :( –  Tobias Sep 14 '12 at 10:19
    
+1 That's why I voted on your question! I want to find a solution, too! –  Anatoly Mironov Sep 14 '12 at 11:18
add comment

2 Answers 2

up vote 1 down vote accepted

The actual answer is:

Use

Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressBasicHttpBindingServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

in your svc file.

The MultipleBaseAddressDataServiceHostFactory one is for REST, where your endpoints are your method (another slash, method name) and you don't have a MEX/wsdl part.

share|improve this answer
add comment

There's no way to do that. The normal welcome page is provided by the handler which handles .svc requests for ASP.NET. In SharePoint, that handler isn't there. It's replaced by the WCF service host factory you specify and that just doesn't supply that page.

So just drop it, or you'll be spending a lot of time trying to find a page which isn't there (and which isn't usefull at all either).

share|improve this answer
    
Thank you, that is a plain answer that I have been waiting for. –  Tobias Nov 15 '12 at 9:27
    
@Jasper - So how come if you browse to _vti_bin/listdata.svc which is the SharePoint WCF Data Service you get the normal WCF welcome screen? –  user13099 Nov 20 '12 at 6:27
    
@John, didn't try that. Could be they routed that one but blocked the other one for security reasons. Result stays the same; you don't need that page anyway, just use the WSDL. –  Jasper Nov 22 '12 at 15:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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