Wednesday, May 22, 2013

Setting Up A Provider Hosted SharePoint 2013 App

Last night I had to work through getting a Provider Hosted App deployed to a SharePoint 2013 farm. We ran into a few issues that I thought would be good to note:

Deploying an App from the App Catalog:
The process for this seemed a little unintuitive to me so I figured I'd document it here:
  • First you go to your AppCatalog site, click on manage SharePoint Apps and add your .app file into the library.
  • The next step is you actually have to add that app to your AppCatalog site (strange). So, go to the settings link, Add an App. Find your app and add it.
  • Once it's been added you can go to Site Contents, locate your app and click the elipses, then select Deployment.
  • Now you can add in the site or template that you want to deploy your app for.
Host Header Web Applications:
Due to the client wanting Forms Based Authentication on this site, but not another we went with setting up a separate web application that used FBA with a host header. In all my other environments I had always used Host Named Site Collections (HNSC), so this was the first time in SP2013 trying to deploy apps with Host Headers.
 
First thing we realized was we had to create a new AppCatalog for this Web Application (that's right, the AppCatalog is for the Web Application). Then when we tried to deploy it to our site we received an error. Thanks to this blog by Mirjam I knew where to look for the solution.
 
When using Host Headers you need to make sure you have a web application that doesn't have a host header at all AND there needs to be a root site collection created. The later is what we were missing. Creating a Team Site as the root site collection resolved the issue and we were able to deploy our app to our site.
 
Setting up Forms Based Authentication against Active Directory
We used this great walk through of setting up FBA from Nishant Shah, and instead of extending the SharePoint web application, we just modified our application to be fully FBA. Completing this got the form up and running, however we were unable to login.
 
After some troubleshooting we found that we needed to add the membership and roleManager entries into the web.config of the root folder of the SharePoint Webservice sites as well. In our case we had to reconfigure the web service to get things working.