Saturday, 14 February 2015

How to configure environment for SharePoint hosted apps on premise?



Note : All the configuration setup should be done using the system account.
Setup DNS for App domain:
To set up DNS go to Administrative tool and select DNS.

How to configure environment for SharePoint hosted apps on premise?

All Apps on SharePoint have unique URL domain names, so before we’re done, we need to set up a wildcard alias.
A wildcard alias basically means you can add anything in front of the domain name and point it to a specific address.
In the DNS manager select for your domain and right click select “New Alias”.

How to configure environment for SharePoint hosted apps on premise?

In the New Resource Record dialog box, enter an asterisk (*) as the Alias name, and then either browse to the record for your server or type in the DNS-name of your server. See the below screenshot.
How to configure environment for SharePoint hosted apps on premise?

Click ok and then ok.
How to configure environment for SharePoint hosted apps on premise?
Setup DNS for Services:

·         Go to central admin, under Application management and select manage services on the server and check for the below 2 service:
    • App Management Service
    • Microsoft SharePoint foundation Subscription Settings Service
  • These 2 services shouldn’t be stopped It should be started.
  • If it is stopped please run the below PowerShell script`
  • Before running powershell scripts use “Start-Transcript”, so that you can track all the commands you are executing in SharePoint 2013 management shell
  • Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"} | Start-SPServiceInstance.
  • After executing the powershell commands please check whether the services are running on the machine from the central administration screen
  • Once you came to know that App management and Subscription Settings services are running, you have to configure respective service applications. To configure please follow the below steps. To perform the below steps Please login as an administrator and run all the below PowerShell  code.
$account = Get-SPManagedAccount “ sp\administrator”.
o   AppManagementService
$appPoolAppSvc = New-SPServiceApplicationPool -Name AppServiceAppPool -Account $account.
o   SPSubscriptionSettingsService
$appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account.
o   Creating AppManagementService Service Application
$appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPoolAppSvc -Name AppServiceApp -DatabaseName Appmanagement_Service_DB.
o   Creating Proxy for AppManagementService service application
$proxyAppSvc = New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc.
o   Creating SubscriptionSettingsService Service Application
$appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SettingsServiceApp –DatabaseName SubscriptionSettings_Service_DB.
o   Creating Proxy for SubscriptionSettingsService service application
$proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc.
You can check the Application services and databases created after running above powershell commands.Please check the below screenshots.
How to configure environment for SharePoint hosted apps on premise?




After doing these setting once again if you go Back to the app and deploy the same you may get the below error:
"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"
·         To resolve the above error switch back to system account and open the SQL server management studio and assign the db_owner permissions to an account which you are using to deploy the app for below databases.

  •  SharePoint_Config.
  •  SharePoint_Admin_ [GUID].
  • Your current web application that needs to host the app.
  • Appmanagement_Service_DB (app management service application database).
  • SubscriptionSettings_Service_DB (Subscription Settings service application database).
  • Grant DOMAIN\myApp_Admin accont a sysadmin server role on SQL server.
  • Open SharePoint Power Shell and execute Add-SPShellAdmin <DOMAIN\myApp_Admin> command.


        Provide full control permissions to the site collection where we are deploying the app.
Make sure that you have added that user under Farm administrators account from central administration.

How to configure environment for SharePoint hosted apps on premise?


        You have all the required the permissions now. Now you can go ahead and deploy the app. Once you deploy the app successfully and trying to view the app then you might get the popup to enter the credentials. Please enter it once however if you get this below pop up again and again then follow the below steps:
How to configure environment for SharePoint hosted apps on premise?


·         On the Sharepoint server,
o   Click on Start -> Run and type regedit.
o   Locate the key 3. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
o   Right click on this key and choose New > DWord Value
o   Name this one "DisableLoopbackCheck"
o    Double-click then on it and type the value “1”
o    Reboot your server.
Once done with the above procedures then try to open the app URL and check for the app to successfully execute.




No comments:

Post a Comment