Configuring an on-premises development environment for Apps
Prerequisites
- A windows server machine , installed and configured for SharePoint
- Microsoft SQL server
- Microsoft visual studio
- Start -> Administrative Tools-> Services
- Or using command prompt
- net start spadminv4
- net start spadminv4
- Go to SharePoint Central Administration
- Application Management -> Service Applications -> Manage Services on Server
- Start App Management Service
- Start Microsoft SharePoint Foundation Subscription Settings service
3. Make sure your user (not SP-Farm) has the following permissions
- securityadmin fixed server role on the SQL Server instance
- db_owner fixed database role on all databases that are to be updated
- Administrators group on the server on which you are running the Windows PowerShell cmdlets
4. Create service applications - Need to create following service applications
- App Management Service Application
- Subscription Settings Service Application
Open the SharePoint Management Shell and run the following commands.
(Account should be the above account )
$account = Get-SPManagedAccount "domain\user"
$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
Then navigate to Central administration -> Application Management -> Service Applications - > Manage Service Application. You will be able to see the newly created above service applications.
5. Configuring App URLs
- Central Administration -> Apps -> Configure App URLs
- Create the app domain name- Ex. App.mydomain.com
- Create the app domain prefix – Ex. App
6. Create a web application
- Central Administration -> Application Management -> Web Application -> Manage Web Application -> Create a new web application
- Central Administration -> Application Management -> Site Collections -> Create Site Collections
Create a site collection with a “Developer Site” template
8. Make sure that the user (created on step 3) has the Db-Owner permission to below databases if not, assign the Db-Owner permission to the user
- SharePoint_Config
- SharePoint_Admin_ [GUID]
- Current web application content database that needs to host the app
- App management service application database
- Subscription Settings service application database
10. Create App
- Open Visual Studio and create a new project with the template “App for SharePoint 2013”
- Put a name for the Sharepoint app
- Put above created site collection URL to sharepoint site for debugging
- Choose "SharePoint-Hosted" for the host type
11. Deploy the application
12. Add below Registry entries to the windows registry
- Go to “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa”
- Add a dword , name = DisableLoopbackCheck , value=1
- Go to “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters”
- Add a dword , name= DisableStrictNameChecking , value=1 , type=decimal
13. Go to your developer site -> Apps In Testing -> Click on the app you have created
14. You will be redirected to the fresh app you just have created
More details read...
Set up an on-premises development environment for SharePoint Add-ins
https://support.microsoft.com/en-us/kb/896861