webservice for sharepoint 2010
最近在研究webservice? for sharepoint ,记录一下 首先添加三个dll引用一个是System.ServiceModel 另一个是Microsoft.SharePoint.Client.ServerRuntime这个dll比较特殊需要通过地址添加 C:WindowsassemblyGAC_MSILMicrosoft.SharePoint.Client.ServerRuntime14.0.0.0__71e9bce111e9429cMicrosoft.SharePoint.Client.ServerRuntime.dll 最后一个System.Runtime.Serialization.dll。 项目的结构图,ISAPI 是sharepoint的一个映射路径,需要添加到vs里面,在里面创建web.config 另外一个文件是需要创建txt文件,修改后缀名得到的文件里面的内容 <%@ ServiceHost Debug="true" Language="C#" 下面是web.config 的内容 <configuration> ? <system.serviceModel> ??? <behaviors> ????? <serviceBehaviors> ??????? <behavior name="命名空间名.webservice文件名+Behavior"> ????????? <serviceMetadata httpGetEnabled="true" /> ????????? <serviceDebug includeExceptionDetailInFaults="false" /> ??????? </behavior> ????? </serviceBehaviors> ??? </behaviors> ??? <services> ????? <service behaviorConfiguration="命名空间名.webservice文件名+Behavior" ????????? name="命名空间名.webservice文件名"> ??????? <endpoint address="" binding="basicHttpBinding" contract="命名空间名.webservice文件接口名"> ????????? <identity> ??????????? <dns value="localhost" /> ????????? </identity> ??????? </endpoint> ??????? <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> ????? </service> ??? </services> ? </system.serviceModel> </configuration> 下面就说说webservice文件怎么创建吧,我是这样做的,新建一个WCF的项目 创建好之后,取出 还有一步非常重要,也是很隐蔽的地方需要修改,就是用记事本打开你解决方案在里面添加一行代码标红的部分 <PropertyGroup> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |