I'm finally done with my long running SP2010 project and am only just now getting into SP2013. And I'm having some trouble understanding the concept of provider hosted apps.
I've read the MSDN article on choosing patterns for developing apps. SharePoint hosted apps apparently can only use SP components and Javascript & HTML. Seems pretty clear, I get that. But then it says provider hosted apps have "remote components [that] are hosted on another server." And you can use "any language", which presumably includes server-side code. So... are provider hosted apps supposed to interact with another, non-SP system?
Then, there's this MSDN tutorial for how to create a basic provider hosted app. In it you create an aspx page that has C# code-behind, which interacts with SP using the CSOM. But it's deployed to the SP server. Where are the remote components? Why is it allowed to run server-side code on the SP server? Admittedly, it's not running SP server object model code, but still, at this point I'm confused.
So, what is a provider hosted app? It can apparently run server-side C# ASP on a SharePoint server...can it run SP server object model code? In the first article I linked to, in the provider hosted section, it says "bring your own server hosting infrastructure." Does that mean you can only deploy provider hosted apps to an on-premises SharePoint farm? Or can you deploy a provider hosted app to the cloud?
Can anyone explain this clearly to me?