Wednesday, March 20, 2013

SharePoint2013: Debugging Provider Hosted Apps

Scenario: You have developed a provider hosted app and installed the app (.app pkg) on to SharePoint site and its app web on to a remote machine. Now how will you debug to figure out issues

Solution: You need to have visual studio installed on remote machine to debug.

Follow below steps for debugging provider hosted apps:-
1. Log on to remote machine where you have installed the app web.
2. Open the app web using visual studio as administrator and set a break point.
3. Log on to AP or FE and navigate to site on which you have installed the app using a browser.
4. Now back in the remote machine in Visual Studio go to Debug-->Attach to Process and attach w3wp.
5. Now in AP and FE server click on the app.
6. Now on the remote machine you see that your break point will hit.

Another way to debug is using IE developer (F12 developer tools) toolbar, by going to "Script" tab and click on "Start debugging".