Article 22 from 30 : Troubleshooting Provider-Hosted App

This post is article 22 from the 30 Articles App series for SharePoint

In this article I will be discussing about basic guidelines on troubleshooting tips for provider hosted apps. I assume that you already has good understanding of provider hosted app and how to develop one.

Below are some steps you should consider to look into when you run into problems:

(1)    Make sure your remote web is already up and running before you deploy your app.

(2)    Make sure all the service are up and running and they have valid listening endpoints if you are using any remote receivers.

(3)    Make sure that you have valid client id in App manifest file, which must be exactly same as client id in your remote web’s web.config file

(4)    Make sure the client id is in lowercase in (3).

(5)    Make sure you have registered your app with SharePoint. You can register your app from Appregnew.aspx  page. It is available via following url : https://SPServer/Sites/AnySiteCollection/_layouts/15/Appregnew.aspx

Store the client id and secret and use that in (3)

appregnew

(6)    When you are deploying your app to office store you can generate client id, Client Secret from office seller-board.

(7)  Make sure your app has all the necessary permission.

Troubleshooting tips continues for Hight-Trust provider hosted app in next article.

Hope that helps..!!

Article 12 from 30 : How to use MVC web project for auto-hosted and provider-hosted sharepoint apps

This post is article 12 from the 30 Articles App series for SharePoint

Today, I will discuss about how you can use the MVC4 web project with your provider or Auto hosted app. And so you can take all the advantages of the latest MVC 4 features with SharePoint Apps.

1) Let’s start with auto/Provider hosted App with default template.

2) Add new project -> select web -> MVC4 web project and create.

20121119-170037.jpg

3) Add TokenHelper.cs file

20121119-170044.jpg

4) Add below references to MVC web project.

  1. Microsoft.Identity
  2. Microsoft.Identity.Extentions you can find it here : C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.IdentityModel.Extensions\v4.0_2.0.0.0__69c3241e6f0468ca\Microsoft.IdentityModel.Extensions.dll
  3. Microsoft.SharePoint.client
  4. Microsoft.SharePoint.client.runtime
  5. System.identitymodel

20121119-170050.jpg

5) Changes to web.config file:

Add appropriate clientId and client Secret under -> section.

6) Make sure that your MVC web is SSL enabled.

7) Now reference this MVC web project as remoteApp web project for your Auto/Provider Hosted App.

right click the SharePoint App project -> choose properties.

Change the property of SharePoint App project -> Web project => select above mvc web project

20121119-170056.jpg

Done. Now you can use you MVC web project with SharePoint Auto/provider hosted app.

Hope that helps..!!

Article 11 from 30 : Understanding default template for provider-hosted and Auto-hosted apps

This post is article 11 from the 30 Articles App series for SharePoint

As you go further with developing apps for SharePoint, soon you will realize the limitation of SharePoint-Hosted App and you would like to step into provider/Auto-Hosted apps. This option will provide you more flexibility with the price of hosting…:P

OK then let’s start today with the default template that we get for Provider-Hosted and Auto-Hosted Apps in SharePoint 2013.

Note : SharePoint 2013 RTM is out but the VS2012 developer tools has not been upgraded yet; so this article is written for SP2013 preview version.

Step – 1 : Create auto-hosted & provider-hosted app with the default template.

Visual studio 2012-> create new project-> select Apps from SharePoint 2013 under SharePoint->Apps

choose the hosting options.

20120923-175124.jpg

Step – 2: Understanding both templates

20121104-154409.jpg

As you compare both , there isn’t any difference in project structure between provider and auto-hosted apps.
In both option, the app web is generated with default page and “TokenHelper.cs” files.

When you chose any of these option, an app web project is created. The main difference is where you host this web application and how do you reference it to your SharePoint app.

Below is what we get with auto-hosted app-manifest file.

20121104-154348.jpg

Below is what we get for provider-hosted app-manifest.

20121104-154358.jpg

AppPrincipal will tell you that this app is auto-hosted or provider-hosted.

When you chose the provider-hosted app, you should provide the exactly same client id that you have in your referenced app-web.

And by carefully changing the values in app-manifest file you can easily convert your app from provider-hosted to auto-hosted and vice-verse.

Provider-hosted app webs are hosted to any ISV providers and auto-hosted are hosted on windows-azure.

I hope today’s article will give you good understanding about the project structure of provider and auto-hosted apps.

Be more flexible in architecture and development of your apps with hosting outside of SharePoint.

Have a happy reading and don’t forget to come back for the next article.