加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

webservice for sharepoint 2010

发布时间:2020-12-17 01:04:08 所属栏目:安全 来源:网络整理
导读:最近在研究webservice? for sharepoint ,记录一下 首先添加三个dll引用一个是System.ServiceModel 另一个是Microsoft.SharePoint.Client.ServerRuntime这个dll比较特殊需要通过地址添加 C:WindowsassemblyGAC_MSILMicrosoft.SharePoint.Client.ServerRu

最近在研究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#"
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项目里面即可。

还有一步非常重要,也是很隐蔽的地方需要修改,就是用记事本打开你解决方案在里面添加一行代码标红的部分


<PropertyGroup>
??? <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
??? <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
??? <SchemaVersion>2.0</SchemaVersion>
??? <ProjectGuid>{A1C9F7DB-6584-4743-A953-EA1E6375B3E3}</ProjectGuid>
??? <OutputType>Library</OutputType>
??? <AppDesignerFolder>Properties</AppDesignerFolder>
??? <RootNamespace>ChongHongKMS</RootNamespace>
??? <AssemblyName>ChongHongKMS</AssemblyName>
??? <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
??? <FileAlignment>512</FileAlignment>
??? <ProjectTypeGuids>{BB1F664B-9266-4fd6-B973-E1E44974B511};{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}??????? </ProjectTypeGuids>
??? <SandboxedSolution>False</SandboxedSolution>
?? <TokenReplacementFileExtensions>svc</TokenReplacementFileExtensions>
??? <SccProjectName>SAK</SccProjectName>
??? <SccLocalPath>SAK</SccLocalPath>
??? <SccAuxPath>SAK</SccAuxPath>
??? <SccProvider>SAK</SccProvider>
? </PropertyGroup>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读