SharePoint Auto hosted app and ASP.NET MVC

Nov 13, 2013

Code apps they said, it will be easier they said…

Visual Studio 2013 comes with a new project model : SharePoint autohosted app ASP.NET MVC (Cool!)

I’m fond of SharePoint, I like MVC, why not mixing them?

Short reminder, SharePoint autohosted apps are only available for Office 365. Technically Office 365 will create an Azure website on demand when app is deployed. The potential cost overhead will be billed directly to the tenant owner.

Once the project is created and the Office 365 developer tenant provisioned (you can have 30 free trial days or one free year if you have an MSDN subscription), the first thing we try is F5 right?

The only thing is when we do that, we have this error message (it’s in French but it says file not found)


Two reasons for this. First we lied to you, cloud isn’t always fast. In order to deploy your app, office 365 needs to do two things.

  • Create a Web which will be a bridge between office 365 and azure

  • Create an azure web site and deploy binaires

And in some situations it can take time.

The other reason is that the project is wrongly configured by visual studio

By default the manifest contains this starting url.


Which corresponds to this XML.


The issue is this URL does not exist in you mvc project, you then have to solutions: edit the manifest or add a URL-rewriting rule in your MVC project.

Keep it simple and smart, I edited the manifest. Here is what you need.


Which will lead to this XML.


Don’t try to get rid of the web project name in the URL (at first I thought it was a relative directory). Visual Studio needs it to replace it by the token equivalent to “url relative to app’s web”. If this token is not in the manifest you’ll have an error message saying that your app package is not valid during deployment (without any other detail).

I hope this article made you save time.

Last edited Oct 18, 2021 by Vincent Biret