寫在前面
SharePoint Add-In = SharePoint App
中文: SharePoint加載項和SharePoint應用程序是一回事
所以看文章,找模板或找設置的時候要默唸:SharePoint加載項和SharePoint應用程序tmd是一回事
加粗表示重要,歡迎入坑
滿心歡喜用VS2013做了一個SharePoint2013 App Demo,F5一鍵運行卻碰到一系列問題,隨記錄,與新手共享.
錯誤1
“未在此網站上啓用應用程序的旁加載”,
解決辦法:
進入SharePoint PowerShell :
Enable-SPFeature -Identity e374875e-06b6-11e0-b0fa-57f5dfd72085 -url <siteurl>
啓用這個Feature 即可!
錯誤2
部署步驟“安裝 SharePoint 應用程序”中出現錯誤: 系統帳戶無法執行此操作。
"Error occurred in deployment step "Installed app for SharePoint": The System Account cannot perform this action"
So the solution is:
- Create a new account.
- Add this account to local admin.
- Then add the account to farm admin group. Open sharepoint central administration, go to Security. From there select Manage the farm administrators group.
- Now open visual studio into different user ( Shift + Right Click, and open with different user ). and put the user which you have created now.
我在虛機域控上開發的,所以角色直接搞域管理員.
用另外一個身份運行VS2013打開App項目時會要求提升權限,點擊使用其他憑據重啓即可
問題3
本地SharePoint服務器不可用。檢查服務器是否正在運行並連接到SharePoint場。
"Error occurred in deployment step "Installed app for SharePoint": The local SharePoint server is not available. Check that the server is running and connected to the SharePoint Farm"
解決辦法:新創建的賬戶要有sql server數據庫的db_owner權限。記住每個數據庫都要設置一遍。
問題4
錯誤 1 部署步驟“安裝 SharePoint 應用程序”中出現錯誤: 只有網站管理員可以安裝或卸載應用程序。
這個好解決:
進入SharePoint2013管理中心 -> 網站集 -> 更改網站集管理員
將新建的賬戶設爲第二管理員即可.
問題5
部署步驟“安裝 SharePoint 應用程序”中出現錯誤: 未能安裝 SharePoint 應用程序。有關詳細信息,請參見輸出窗口。
輸出窗口:
@"錯誤 1
相關 ID: 909d6d6b-f983-420a-800f-36c32230ed11
錯誤詳細信息: 此站點上已禁用應用程序。
錯誤類型: Configuration
錯誤類型名稱: 配置
異常消息: Microsoft.SharePoint.SPException: 無法安裝應用程序。請檢查診斷日誌,瞭解有關應用程序部署失敗的詳細信息。
解決辦法:
sahrepoint2013安裝完後,需要通過powershell創建app domain,注意不要和所域使用相同的Domain
腳本如下,加精部分需要替換成你自己的,用管理員身份運行powershell.
Add-PsSnapin Microsoft.SharePoint.PowerShell
# net start spadminv4
#net start sptimerv4
Set-SPAppDomain "spApp.com"
Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"} | Start-SPServiceInstance
Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"}
$account = Get-SPManagedAccount "sp\administrator"
$appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account
$appPoolAppSvc = New-SPServiceApplicationPool -Name AppServiceAppPool -Account $account
$appSubSvc = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $appPoolSubSvc -Name SettingsServiceApp -DatabaseName SettingsServiceDB
$proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $appSubSvc
$appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPoolAppSvc -Name AppServiceApp -DatabaseName AppServiceDB
$proxyAppSvc = New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc
Set-SPAppSiteSubscriptionName -Name "app" -Confirm:$false
問題6
問題5的後續,執行最後一句命令時報錯:
PS C:\Windows\system32> Set-SPAppSiteSubscriptionName -Name "app" -Confirm:$false
Set-SPAppSiteSubscriptionName : 完成此請求所需的設置或服務當前不可用。請稍後重試此操作。如果問題仍然存在,請與系統管理員聯繫。
所在位置 行:1 字符: 2
+ Set-SPAppSiteSubscriptionName -Name "app" -Confirm:$false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share...ubscriptionName:SetSPAppSiteSubscriptionName) [Set-SPAppSiteSubscriptio
nName],SPException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Administration.SPAppCmdlets.SetSPAppSiteSubscriptionName
對應英文:
Settings or services required to complete this request are not currently available. Try this operation again later. If the problem persists, contact your administrator.
解決辦法:
確保以下服務處於運行狀態,
1. App Management Service Application
2. Microsoft SharePoint Foundation Subscription Settings Service Application
3. Managed Metadata Service
另可參考如下文章提到的服務
https://blogs.msdn.microsoft.com/how24/2013/06/14/prepare-your-sharepoint-2013-farm-for-app-development-and-debugging/
如果你的服務狀態都沒有問題,那麼恭喜你和我遇到相同的問題,頭疼吧.
頭疼過後依然要解決問題.這就是攻城獅 哈哈哈!
嘗試給服務設權限時發現Managed Metadata Service無法連接,哈,總算找到問題了.
打開IIS管理器,沒錯,是IIS管理器,然後看到三個應用程序池處於停止狀態,查看對應的應用程序,和Sharepoint服務相關,全部啓動,問題搞定.
問題7
怎麼還有問題7,木錯,還有問題7,顫抖麼,你擼多了 騷年!
F5一鍵運行,彈出如下錯誤對話框:
無法啓動程序”http://....../_layouts/15/AppRedirect.aspx?instance_id=......”
查看輸出窗口,發現輸出了App安裝好的地址,所以忽略上面那個錯,直接訪問.
然後然後就有了本問題:
登錄,無限跳出用戶密碼輸入框
解決方案:
修改兩個註冊表選項,來禁止環回檢查
1>. 啓動註冊表編輯器 (Regedt32.exe)。
2>. 在註冊表中找到並單擊以下項:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters
3>. 在編輯菜單上,單擊添加數值,然後添加以下註冊表值:
數值名稱:DisableStrictNameChecking
數據類型:REG_DWORD
基數:十進制
數值: 1
4>. 在註冊表編輯器中,找到並單擊下面的註冊表項:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
5>. 右鍵單擊“Lsa”,指向“新建”,然後單擊“DWORD 值”。
鍵入 DisableLoopbackCheck,然後按 Enter。
右鍵單擊 DisableLoopbackCheck,然後單擊“修改”。
在“數值數據”框中,鍵入 1,然後單擊“確定”。
6>. 退出註冊表編輯器,然後重新啓動您的計算機。
問題8
就是上面彈的那個無法啓動程序的對話框.
這個應該是VS的問題,用那個地址直接敲入瀏覽器是可以訪問的,所以也就不解決啦.
呼... 終於完成了.
遇到這麼多問題可能和我的Sharepoint版本有關,用的是RTM版,連sp1都沒打...
參考文章:
http://www.enjoysharepoint.com/Articles/Details/error-occurred-in-deployment-step-install-app-for-sharepoint-the-20819.aspx
http://www.cnblogs.com/jindahao/p/3580871.html
http://www.cnblogs.com/langu/p/4134881.html
https://msdn.microsoft.com/zh-cn/library/office/fp179923.aspx
https://blogs.msdn.microsoft.com/how24/2013/06/14/prepare-your-sharepoint-2013-farm-for-app-development-and-debugging/
https://sharepoint.stackexchange.com/questions/67034/error-while-opening-configure-app-urls-in-central-admin-sp2013
http://www.cnblogs.com/chenxizhang/p/3397543.html