Monday, June 30, 2014

Setting up App domain for SharePoint 2013 using PowerShell

Hello everybody,

Today we will prepare our SharePoint 2013 development environment to deploy app to your local machine.

So if you have a clean Virtual Environment with Windows Server 2008 R2 dacacenter, SQL 2008 R3, SharePoint 2013 instance, as I do, I suppose after that you have installed also Visual Studio 2012.

After that you opened your VS2012, made a new SharePoint Provider-hosted app and tried to deploy you got an error below, as I did, then you will need to set up App domain for SharePoint 2013:



Problem

  @"Error 1

        CorrelationId: c81cc07a-7b17-4714-b831-8d5e8507d53a

        ErrorDetail: Apps are disabled on this site.

        ErrorType: Configuration

        ErrorTypeName: Configuration

        ExceptionMessage: Microsoft.SharePoint.SPException: Apps cannot be installed. Review the diagnostic logs for more details regarding app deployment failures.

   at Microsoft.SharePoint.Utilities.SPUtility.ThrowSPExceptionWithTraceTag(UInt32 tagId, ULSCat traceCategory, String resourceId, Object[] resourceArgs)

   at Microsoft.SharePoint.Packaging.SPUserCodeSolutionDeploymentGroup.Deploy()

   at Microsoft.SharePoint.Administration.SPAppTask.DeployOperation()

   at Microsoft.SharePoint.Lifecycle.MonitoredTaskExecution.DoTask()

        Source: AppWeb

        SourceName: App Web Deployment

Error occurred in deployment step 'Install app for SharePoint': Failed to install app for SharePoint. Please see the output window for details.

If you look in ULS log and find the correlation ID you will see the followoing message:

Returning error with exception information. Type: Configuration, Source: AppWeb, Detail: Apps are disabled on this site., Correlation: c81cc07a-7b17-4714-b831-8d5e8507d53a, Exception: Microsoft.SharePoint.SPException: Apps cannot be installed. 



Solution






Set-SPAppDomain "greatsolution.com"


$cred = Get-Credential
$account = New-SPManagedAccount -Credential $cred
$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
Set-SPAppSiteSubscriptionName -Name "app" -Confirm:$false



Now you can deploy you APP

NOTE: You can only deploy apps for SharePoint from Visual Studio 2012 to a Developer Site.

Add your isolated app domain to your bypass list in Internet Explorer

1.      In Internet Explorer, go to Tools.
2.      Choose Internet options.
3.      On the Connections tab, choose the LAN Settings button.
4.      Clear the Automatically detect settings check box.
5.      Select the Use a proxy server for your LAN check box.
6.      Choose the Advanced button, and then add *.YourAppDomain.com to the Exceptions list.
7.      Choose the OK button.
8.      Choose the OK button to close the Local Area Network (LAN) Settings dialog box.
9.      Choose the OK button to close the Internet Options dialog box.


URL to microsoft site :


Have a good day!!!! :)


No comments:

Post a Comment