How to create a WCF REST Service in SharePoint 2013

Source: Internet
Author: User
Tags requires

SharePoint 2013 is developers provide a rich rest API that facilitates our data in the Client action list. Of course, we can also create a custom rest service in SharePoint 2013, such as working with the database through the rest service. This blog post describes how to create a WCF REST Service in SharePoint 2013.

Create WCF Service in SharePoint

Because you cannot add a WCF service Template in SharePoint 2013 project, you create a WCF service application in advance, dragging the contract interface and the SVC service to SharePoint Project. So you need the following steps:

1. Create WCF Service Application

2. Create a SharePoint mapped Folder ISAPI in SharePoint Projectbecause the services (. svc) that are accessible in SharePoint 2013 exist: C:\Program files\ Common Files\Microsoft Shared\Web Server Extensions\15\isapi folder, corresponds to the virtual directory _vti_bin in IIS.

3. Drag the SVC for WCF Service application to the ISAPI folder as follows:

4. Modify the namespace and add the assembly reference as follows:

5. Because SharePoint project requires a strong name key File, referencing this assembly requires providing Publictoken (sn-t Assembly.dll, using the method reference: http:// www.cnblogs.com/OceanEyes/p/custom-provider-in-sharepoint-2013-fba-authentication.html)

6. Modify Svc

<%@ ServiceHost language= "C #" debug= true "service=" Eyes.customrestservice.service1,eyes.customrestservice, version=1.0.0.0,culture=neutral,publickeytoken= bf65dbaa17f24124 "codebehind=" Service1.svc.cs "%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.