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.


Step – 2: Understanding both templates


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.


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


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.