`
yangzhiyong77
  • 浏览: 975411 次
文章分类
社区版块
存档分类
最新评论

webservice for sharepoint 2010

阅读更多

最近在研究webservice for sharepoint ,记录一下

首先添加三个dll引用一个是System.ServiceModel

另一个是Microsoft.SharePoint.Client.ServerRuntime这个dll比较特殊需要通过地址添加

C:\Windows\assembly\GAC_MSIL\Microsoft.SharePoint.Client.ServerRuntime\14.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.ServerRuntime.dll

最后一个System.Runtime.Serialization.dll。

项目的结构图,ISAPI 是sharepoint的一个映射路径,需要添加到vs里面,在里面创建web.config

另外一个文件是需要创建txt文件,修改后缀名得到的文件里面的内容

<%@ ServiceHost Debug="true" Language="C#"
Service="SharePointProject2.Service1, $SharePoint.Project.AssemblyFullName$"
CodeBehind="Service1.cs" %>这个也是需要调用的服务文件

下面是web.config 的内容

<?xml version="1.0" encoding="utf-8" ?>

<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的项目

创建好之后,取出里面接口文件跟服务文件添加到创建好的sharepoint项目里面即可。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics