On Premises Napa App development in SharePoint 2013 is not that straight forward as usual application development in SharePoint. It requires some specific configuration settings to host the App. One of the main requirement is to have a separate App domain. In this article we can see how to configure the local development environment to enable development of SharePoint 2013 Napa Apps.
The below are the list of steps that are required to enable Napa app development in local environment.
1. Creating an App Domain
2. Configuring App URLs
3. Configuring Service Application
4. Creating the first Napa App
Now lets have a look at the steps one by one
1. Creating an App Domain
To begin with , let's start with the domain name creation part. A new domain or sub domain can be created in DNS and can be mapped to a SharePoint Web Application. As I have not configured DNS in my DEV environment ( Windows server 2012 ) I changed the host file and configured windows registry to create a new domain name.
If you have configured DNS and would like to perform domain creation via DNS check out this link
The below are the steps that I have followed to configure an app domain named "apps.sfs.in".
1. Locate the host file (no extension) in the path C:\Windows\System32\drivers\etc
2. Open host file in a notepad or a text editor
3. Add a new entry to the file as below
The name apps.sfs.in has nothing to do with the website named sfs.in , I used this name as it’s an abbreviation of our company SharePoint Frontier Software Solutions, You can also have your own preferred name.
Follow the below steps to make necessary changes in Registry
1. Open the registry editor by typing regedit in the command prompt.
2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters
3. Add a new DWORD with key DisableStrictNameChecking
4. Edit and set its value to 1 (Decimal)
5. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
6. Add a new DWORD with Key DisableLoopbackCheck
7. Edit and set its value to 1 (Decimal)
8. Re-Start your machine to enable the changes you have made.
Check out this article on configuring host header for SharePoint environment at http://www.ashokraja.me/post/Host-Header-in-Share-Point-for-Development-Environment.aspx
Mapping the Host Header
The next step is to create a new Web Application and mapping the newly created host header to that web application.
1. Create a new Web Application ( I have created under the port 1976 with the name "SharePoint Apps" and my web application URL is http://win2k12:1976)
2. Create a new Site Collection with Blank Template
Note : This site collection wont be used any where in the Napa App. The above 2 steps are required to assign our domain name as host header in ISS for an Web Application.Technically, to assign a host header in IIS, the web application is not mandatorily to be a SharePoint Web Application, but for the safer side , lets have a SharePoint Web Application with Alternate Access Mapping mapped to the domain name we have already created.
3. Configure Alternate Access Mapping by navigating to System Settings in Central Admin
4. Click the Edit Public Url's Link and select the web application you have created in the step 1.
5. Assign the value for Intranet to http://apps.sfs.in ( The name used in host file with http added to it)
6. Now Open the IIS ( Run=> Inetmgr)
7. Select the Web Application you have created in Step 1 and click the Bindings link available in the Actions Tab
8. Select the existing item and click Edit. Change the host name to the name you have used in host file (In my case it is apps.sfs.in) and the port number to 80
9. Save the changes
10. Now open the url http://apps.sfs.in/ in a browser. If you have configured all the steps properly, you would be able to see a page like the one shown below
2. Configuring Service Application
Napa Apps in SharePoint 2013 requires App Management Service and Microsoft SharePoint Foundation Subscription Settings Service up and running.Check out its status by navigating to http://[CentralAdmin]/_admin/Server.aspx (In Central Admin navigate to System Settings => Servers => Manage Service On Server)
If they are not started, start those services.
The next step to create service application and application proxy for the above mentioned services.
In Central Admin navigate to Application Management => Service Applications => Manage Service Applications
Check for the availability of Service Application Type "App Management Service Application", if its not available create a new Service Application by clicking the "new" option and selecting the App Management Service. Provide the necessary values and create the service application along with the proxy (A check box will be there to enable proxy creation, ensure that its selected while creating the service application).
The next step is to create Microsoft SharePoint Foundation Subscription Settings Service . As of now, there is no option to create this service application via Central Admin. The only option available right now is to create this service through Power Shell.
Open the SharePoint 2013 Management Shell and execute the below power shell script after changing the domain and user name to create a new Service Application and Application Proxy for Microsoft SharePoint Foundation Subscription Settings Service . Ensure that the account used to execute the below scripts at Management Shell has Farm Admin privileges.
For more details check out this link in MSDN which describes this step.
$account = Get-SPManagedAccount "domain\user"
$appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account
$appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SettingsServiceApp –DatabaseName SettingsServiceDB
$proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc
3. Configuring App URLs
The next step is to assign the app domain to SharePoint Apps . Select the Apps link the Central Admin and navigate to "Configure App Urls" link.
Assign the App domain name and App prefix name as shown below
Note : All the apps once deployed would be assigned an URL in the format shown bellow. In that app hash is a unique key generated by SharePoint for each and ever app.
http://[app prefix][app hash].[app domain]/[relative site url]/[app name]
4. Creating the first Napa App
Now we have got all the pre-requisites met and its time to create our first on-premises Napa App.
Create a new Web Application and a Site Collection ( I have created under port 2020)
Open Visual Studio 2012 and create a new project and select App for SharePoint 2013 available under Apps section of Office/SharePoint .
Provide a appropriate name and click ok.
In this step provide a name for you app , development web site (Its not the one already we have created for configuring host header ) and select the SharePoint hosted option.
Now with out making any code change lets build and deploy the app to ensure that the environment is correctly configured for Napa Apps.
Once its successfully deployed a new App with the name SharePointApp1 will be added to the list of Apps in the target site. Check this out by navigating to Site Content page.
Click this App to view its content. Since we have not configured any thing , the default app welcome page will be displayed as shown below.That's it. Now we have created our first Napa App for SharePoint 2013