Continuation to the post Developing a SharePoint-Hosted App in SharePoint 2013 Part -I .
Once we verified that the above services are running do these next steps..
Step 2 :
Now we need to create domain for apps and register this domain to sharepoint. So that our apps will be hosted separately when we deploy them.
Run this PowerShell command to create the app domain. You should be an administrator with the Managed Account. Here my domain name is nature.com
So for naming conventions (or to follow principles J) , If your domain name is nature.com, give your domain name for apps as like natureapps.com
Set-SPAppDomain "natureapps.com".
Now we need to create the AppManagement and subscription service applications as mentioned above.
Step 3 :
Creating the App Management and Subscription Setting Service applications
Ensure that the SPSubscriptionSettingsService and AppManagementServiceInstance services are running with these below cmdlets(if they are not running this cmdlet will make them to run)
Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"} | Start-SPServiceInstance
You will get this message if they are already running
Central AdministrationàManage services on server under System Settings category
These services are running now, so the next step is we need to create the respective service applications with the below cmdlets. To do this you should have a SPManagedAccount.(or u can run with farm admin if it is a managed account).
If you want to create new managed account follow these steps : This **** marked step is optional if you have already a managed account
*****************************************
$account= New-SPManagedAccount
It will ask the credentials for the user to whom you want to make the Managed Account(in my case im giving farm admin credentials itself, since i want to use my farm admin as a managed account for this )
Now create the service apps with below cmdlets using this Managed Account.
$account = Get-SPManagedAccount “nature\administrator”(your domain name\user name)
$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
If you notice the above cmdlets, here we are creating the AppManagement Service application and SubscriptionSettingsServiceApplication. This will create two databases too.
Check this Msdn url to get all the cmdlets at a place.
Check this Msdn url to get all the cmdlets at a place.
So now lets verify whether these service applications are created or not .
Go to Central Administration àApplication Management àManage service applications check these two
And also verify ourAppdomain(natureapps.com) configured or not. Go to Central AdministrationàSelect Apps àThen select Configure App Urls under App Management.
Now you can find the App Domain as “natureapps.com”.And give app prefix for the app. This will be used in the app url. Here I have given as “spapps”.And says OK.(This app prefix can be given through powershell as like appdomain name, but i missed it).
With these, you have completed the settings required to deploy the sharepoint-hosted App. Now try to deploy the app. Once it got deployed successfully you will find this message in the output window
If you notice this message, it is showing that the app is successfully installed at
Spapp - is the prefix what we have provided just now
cdab466a043db3- is the app id dynamically generated one
natureapps.com- is our app domain name
SharePointDemoApp1- is our app name
Now check the app from the SharePoint site (where we deployed our visual studio app solution ) à Site ContentsàCheck our App .
Now Click on it.It will redirect to our app site.( http://spapp-cdab466a043db3.natureapps.com/SharePointDemoApp1/.)
No comments:
Post a Comment