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 inTokenReplacementFileExtensions
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