0

I am quite new to SharePoint Apps.

Following the below steps, have created a SharePoint hosted App in SP 2016 on premise farm;

Configuring an “on-premise” development environment for Apps for SharePoint

Step 1: Create an Isolated App Domain

If you want to create and deploy SharePoint Hosted apps, you must create an isolated app domain where your apps for SharePoint will run. 1. Start the SharePoint 2013 Management Shell.

• net start spadminv4 • net start sptimerv4

  1. Create your isolated app domain your apps, for example “apps.practise.com”.

• Set-SPAppDomain “apps.practise.com”

  1. Ensure that the SPSubscriptionSettingsService and AppManagementServiceInstance services are running.

<code><span class="typ">Get</span><span class="pun">-</span><span class="typ">SPServiceInstance</span> <span class="pun">|</span> <span class="kwd">where</span><span class="pun">{</span><span class="pln">$_</span><span class="pun">.</span><span class="typ">GetType</span><span class="pun">().</span><span class="typ">Name</span> <span class="pun">-</span><span class="pln">eq </span><span class="str">"AppManagementServiceInstance"</span> <span class="pun">-</span><span class="kwd">or</span><span class="pln"> $_</span><span class="pun">.</span><span class="typ">GetType</span><span class="pun">().</span><span class="typ">Name</span> <span class="pun">-</span><span class="pln">eq </span><span class="str">"SPSubscriptionSettingsServiceInstance"</span><span class="pun">}</span> <span class="pun">|</span> <span class="typ">Start</span><span class="pun">-</span><span class="typ">SPServiceInstance</span></code>
  1. Verify that the SPSubscriptionSettingsService and AppManagementServiceInstance services are running.

<code><span class="typ">Get</span><span class="pun">-</span><span class="typ">SPServiceInstance</span> <span class="pun">|</span> <span class="kwd">where</span><span class="pun">{</span><span class="pln">$_</span><span class="pun">.</span><span class="typ">GetType</span><span class="pun">().</span><span class="typ">Name</span> <span class="pun">-</span><span class="pln">eq </span><span class="str">"AppManagementServiceInstance"</span> <span class="pun">-</span><span class="kwd">or</span><span class="pln"> $_</span><span class="pun">.</span><span class="typ">GetType</span><span class="pun">().</span><span class="typ">Name</span> <span class="pun">-</span><span class="pln">eq </span><span class="str">"SPSubscriptionSettingsServiceInstance"</span><span class="pun">}</span></code>
  1. You must specify a farm admin account under which the SPSubscriptionService and AppManagementServiceInstance services will run. This farm admin account must be an SPManagedAccount. If your farm admin is not an SPManagedAccount, you can create a SPManagedAccount with your farm admin credentials by typing the following command in the SharePoint Management Shell (You will be prompted for the farm admin domain\user and password).

<code><span class="pln">$account </span><span class="pun">=</span> <span class="typ">New</span><span class="pun">-</span><span class="typ">SPManagedAccount</span></code>
  1. Specify a farm admin account, application pool, and database settings for the SPSubscriptionService and AppManagementServiceInstance services.

$account = Get-SPManagedAccount “domain\username” $appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account

<code><span class="pln">    $appPoolAppSvc </span><span class="pun">=</span> <span class="typ">New</span><span class="pun">-</span><span class="typ">SPServiceApplicationPool</span> <span class="pun">-</span><span class="typ">Name</span> <span class="typ">AppServiceAppPool</span> <span class="pun">-</span><span class="typ">Account</span><span class="pln"> $account

    $appSubSvc </span><span class="pun">=</span> <span class="typ">New</span><span class="pun">-</span><span class="typ">SPSubscriptionSettingsServiceApplication</span> <span class="pun">–</span><span class="typ">ApplicationPool</span><span class="pln"> $appPoolSubSvc </span><span class="pun">–</span><span class="typ">Name</span> <span class="typ">SettingsServiceApp</span> <span class="pun">–</span><span class="typ">DatabaseName</span> <span class="typ">SettingsServiceDB</span><span class="pln">

    $proxySubSvc </span><span class="pun">=</span> <span class="typ">New</span><span class="pun">-</span><span class="typ">SPSubscriptionSettingsServiceApplicationProxy</span> <span class="pun">–</span><span class="typ">ServiceApplication</span><span class="pln"> $appSubSvc

    $appAppSvc </span><span class="pun">=</span> <span class="typ">New</span><span class="pun">-</span><span class="typ">SPAppManagementServiceApplication</span> <span class="pun">-</span><span class="typ">ApplicationPool</span><span class="pln"> $appPoolAppSvc </span><span class="pun">-</span><span class="typ">Name</span> <span class="typ">AppServiceApp</span> <span class="pun">-</span><span class="typ">DatabaseName</span> <span class="typ">AppServiceDB</span><span class="pln">

    $proxyAppSvc </span><span class="pun">=</span> <span class="typ">New</span><span class="pun">-</span><span class="typ">SPAppManagementServiceApplicationProxy</span> <span class="pun">-</span><span class="typ">ServiceApplication</span><span class="pln"> $appAppSvc</span></code>

Step 2: Start the Required Services

To verify this, click Start -> point to Administrative Tools -> and then click Services. In the Services list, verify that the SharePoint Administration and SharePoint Timer services are running. For apps to work, you need to have the App Management and Subscriptions Settings Service Applications configured. Before creating these service applications verify that the following services are running in the Manage Services on Server page. • App Management Service • Microsoft SharePoint Foundation Subscription Settings service You can verify the same from the Services on Server page in central admin.

Step 3: Configure App URLs

To configure App URLs using Central Admin, follow the below mentioned steps. • In Central Admin, click on Apps. • In Apps page, click on Configure App URLs. • In the App domain box, type the app domain that was created earlier for hosting apps. In our case we have used app.practice.com. • In the App Prefix box, type a name to use for the URL prefix for the apps. • Click OK.

• Open Visual Studio 2013 instance and select App for SharePoint 2013 template to create the project. • Select SharePoint-hosted as the hosting platform for our app. • Put the site collection URL on which we want to deploy app. (Site collection template should be developer site). • Here App.js file is our main JavaScript file where the entire logic is there and default.aspx is the landing page of the app where we will reference the App.js file. • If you look at the App.js file, by default some logic is written there. It is fetching the current logged in user’s name and displaying that. Let us keep it same and not add any business logic here and try deploying this app. • Right click on the project name and deploy. You might encounter below errors.

Error 1: “Error occurred in deployment step ‘Install app for SharePoint’: The System Account cannot perform this action.” SharePoint will not allow you to install nor uninstall apps using the farm account (System Account). If you try to deploy your app using Visual Studio F5 you will get one of the following errors if you do it using System Account: Solution: Now try to log in into the machine using some other account and try to install the app. You might receive the following error.

Error 2: “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” Solution: To resolve the above error login using system account and open the SQL server management studio and assign the db_owner permissions to the account which you are using to deploy the app for below databases. • 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 (Optional)

Now try to deploy the App. App will be successfully deployed.

The deployed App is showing in Website content. However on click of app name a blank page gets generated.

Kindly let know what i am missing.

(Visited 149 times, 1 visits today)
Add a Comment