一、创建SharePoint hosted 工程

1、创建承载SharePoint Add-in独立域

首先,确定承载的应用程序的独立域名,可以使用类似这样的域名apps.contoso.com,鉴于众多的域名,可以在DNS中添加一个泛域名解析*.contoso.com,指向SharePoint IP地址。这样所有以contoso.com结尾的域名都指向这个IP地址。Setup DNS for domain

也可以直接在host SharePoint环境添加host映射,IP 域名。例:10.2.88.38  apps.contoso.com

2、更改AppMainfest.xml权限控制,根据项目实际需要来定

3、Configure an isolated add-in domain in SharePoint

二、deploye SharePoint Add-in工程

注意点:

1、 deploy SharePoint host 工程不能用system account用户

2、需要给deploy add-in的user loginName添加public,db-owner及sysadmin的权限

3、

Error 1:

Error occurred in deployment step 'Install app for SharePoint': The System Account cannot perform this action.

Error 2:

The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm.

Error 3:

Error occurred in deployment step 'Install app for SharePoint': We're sorry, we weren't able to complete the operation, please try again in a few minutes. If you see this message repeatedly, contact your administrator.

Solution:

For error 1, follow these instructions:

a. Create a new domain account DOMAIN\myApp_Admin

b. add DOMAIN\myApp_Admin to local admin group

c. add DOMAIN\myApp_Admin to Farm Administrators group

Central Admin site --> Site Settings --> People and groups

Add DOMAIN\myApp_Admin

For error 2 & 3, follow these instructions:

1. Grant DOMAIN\myApp_Admin accont a sysadmin server role on SQL server

2. Open SharePoint Power Shell and execute Add-SPShellAdmin <DOMAIN\myApp_Admin> command.

3. Grant DOMAIN\myApp_Admin a db_owner rights to web application Content database that you would like to use for debugging SharePoint 2013 app.

4. Make sure following roles are assigned for SharePoint_Config database

SharePoint_Shell_Access

SPDDataAccess

public

5. Make sure following roles are assigned for SharePoint_Content database

db_owner

5. Make sure following roles are assigned for SharePoint_AdminContent database

public

三,异常处理

http://www.sharepoint-journey.com/app-development-in-sharepoint.html#gallery[pageGallery]/4/

http://www.sharepoint-journey.com/app-management-sharepoint-2013.html#gallery[pageGallery]/14/

https://social.msdn.microsoft.com/Forums/vstudio/en-US/c8eb6c92-e1b2-45a9-840e-c782bdc933ec/error-occurred-in-deployment-step-install-app-for-sharepoint-were-sorry-we-werent-able-to?forum=sharepointdevelopment

05-11 19:22