Why I am Getting error of "End point Not found" for MultipleBaseAddressWebServiceHostFactory while hosting WCF service in sharepoint 2010 ?
-
segunda-feira, 16 de abril de 2012 07:25
Hello,
I have created sample Empty sharepoint project named"DemoProject" and added WCF service under ISAPI mapped folder named"DemoService".
My Project structure is as below:
While this service has method to get current date as string named "GetCurrentDate()" method.
below is code of IDemoService Interface file
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text; namespace DemoProject { // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IDemoService" in both code and config file together. [ServiceContract] public interface IDemoService { [OperationContract] string GetCurrentDate(); } }
below code I have written into DemoService Class file that implements above method.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint; using System.ServiceModel; using Microsoft.SharePoint.Client.Services; using System.ServiceModel.Activation; namespace DemoProject { [BasicHttpBindingServiceMetadataExchangeEndpoint] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] public class DemoService :IDemoService { #region Methods : Public public string GetCurrentDate() { return DateTime.Now.ToShortDateString(); } #endregion } }Below is "DemoService.svc" file content.<%@ ServiceHost Language="C#" debug="true" Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Service="DemoProject.DemoService,$SharePoint.Project.AssemblyFullName$" %>After Deployment to my sharepoint site I get following error on "`/_vti_bin/DemoService.svc/mex/"I have also added following line in <PropertyGroup> of this project
<TokenReplacementFileExtensions>svc</TokenReplacementFileExtensions>
Can anyone please let me know Why I am getting "Endpoint not found" error ????
Please help me out for this !!!!
Thanks a ton.....
Dipti Chhatrapati
- Editado Dipti Chhatrapati segunda-feira, 16 de abril de 2012 07:37
Todas as Respostas
-
segunda-feira, 16 de abril de 2012 08:22Moderador
Hi,
Open Your WCF service config file and check whether endpoint tag is there or not.
Just add below line of code in your config file and check
<system.serviceModel>
<services>
<service behaviorConfiguration="DemoProject.DemoProjectBehavior"
name="DemoProject.DemoService">
<endpoint address="" binding="basicHttpBinding" contract="DemoProject.IDemoService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DemoProject.DemoProjectBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<!--<dataContractSerializer maxItemsInObjectGraph="2147483646"/>-->
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>Hope it could help
Cheers, Hemendra-MCTS "Yesterday is just a memory,Tomorrow we may never see"
-
terça-feira, 17 de abril de 2012 10:14
hi Hemendra,
I added web.config and its working fine, however I am not able to get anything in "/_vti_bin/DemoService.svc/mex/".Its not displayin endpoint details.DemoService's web.config file is as below
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="DemoProject.DemoProjectBehavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> <!--<dataContractSerializer maxItemsInObjectGraph="2147483646"/>--> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="DemoProject.DemoProjectBehavior" name="DemoProject.DemoService"> <endpoint address="" binding="basicHttpBinding" contract="DemoProject.IDemoService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> </system.serviceModel> </configuration>Please let me know Why I am not getting anything at "/_vti_bin/DemoService.svc/mex/" ?
Thanks,
Dipti Chhatrapati
-
terça-feira, 17 de abril de 2012 12:22Moderador
Since you are using A REST Service call I think you need to add the [WebGet] attribute to your IDemoService service contract.
http://msdn.microsoft.com/en-us/library/system.servicemodel.web.webgetattribute.aspx
Regards Bjoern
- Sugerido como Resposta Hemendra AgrawalMicrosoft Community Contributor, Moderator sexta-feira, 20 de abril de 2012 05:13
-
quarta-feira, 18 de abril de 2012 05:38
Hi Bjoern,
I tried to use this attribute as per you said but it has thrown following error:
can you please let me know what I am missing !!!
Thanks,
Dipti Chhatrapati
-
quarta-feira, 18 de abril de 2012 14:34
Add "using System.ServiceModel.Web;"- Sugerido como Resposta Hemendra AgrawalMicrosoft Community Contributor, Moderator sexta-feira, 20 de abril de 2012 05:13
- Marcado como Resposta Shimin Huang sexta-feira, 27 de abril de 2012 08:21

