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.
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?