Partilhar via


Debugging SharePoint Apps That Are Hosted In Windows Azure Web Sites

Today, I'm going to be the lazy human I'm so frequently accused of being by my somewhat faithful dog Shasta, and bring together two posts written by two other folks into one uber "ain't it cool how this all works together post" by me. Here are the two concepts we're combining today:

Now, once our SharePoint App has been published to a Windows Azure web site, the error prone and/or forward-thinking amongst you may be wondering...um, great...so what do I do to track down bugs? Well that's where the second piece of brilliant advice that I had nothing to do with comes in.

Now, let's briefly walk through the steps to combine these two nuggets of goodness:

  1. Create a SharePoint provider hosted app and verify that it works.
  2. Create an Azure web site and download publishing profile. (in Vesa's video)
  3. Use appregnew.aspx to get a client ID and client secret. (in Vesa's video)
  4. Publish the App to your Windows Azure site using the publishing profile, client ID and client secret retrieved in the previous steps. (in Vesa's video)
  5. Create the app package, install it to your app catalog, and add it to your site. (in Vesa's video)
  6. Open Server Explorer in Visual Studio 2013, right-click on the Windows Azure node and select Connect to Windows Azure...
  7. Expand to see all the Azure services, and then expand the collection of Web Sites.
  8. Right-click on the Azure web site where you published your provider-hosted app and select Attach Debugger.
  9. The browser opens to your Azure web site, and VS.NET starts up in debugging mode. Set your breakpoints in your code and start debugging!

See the remotely debugging Azure web sites post for the details on pre-requisites, but in short you need Visual Studio 2013 and the Azure 2.2 SDK for VS 2013; you will find a link to that in the blog post. (NOTE: that same post also describes how to do this with Visual Studio 2012 but I have not tried that) This actually works pretty great and I was able to get a first-hand experience using it when I went through the steps for this blog post. As it turns out, the SharePoint site where I installed my sample application uses the Url https://sps2. Well, the problem of course is that in my Azure Web site, my code was trying to make a CSOM call to an endpoint at "sps2". That works great when I'm in my lab environment, but out in the interwebs that Azure lives in of course it cannot resolve to a simple NetBIOS name (remember, this code is running server side, not client side). So as a result it was blowing up. By using this cool new debugging feature I was able to find my issue, appropriately for this debugging post. Here's a screenshot of it in action:

 

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Hello Steve,

    I followed your steps, but I get error -
    "A remote operation is taking longer than expected"

    and then alert error message
    "The following error occurred when tried to launch remote debugging: Exception from HRESULT: 0x89710023"

    Could you please guide, if I am missing something?
    Thank you.

  • Anonymous
    January 01, 2003
    thanks for sharing.

  • Anonymous
    December 02, 2013
    I love the new debugging stuff in Azure Websites ... so handy for those "well it works on my machine" moments.  Something else i have been doing in all my Azure code is adding some tracing/debugging output using SignalR. This gives you a real time monitoring visibility in your code ... good for non-intrusively debugging your code. When you do the VS debugging for Azure it will stop other requests from executing so sometimes you need a little lighter touch if your code is in production.  I wrote it up here if you are interested:   www.looselytyped.net/.../sharepoint-provider-hosted-apps-in-azure-monitoring-tip

  • Anonymous
    May 14, 2014
    Nanddeep,

    Check http://stackoverflow.com/questions/21188108/azure-remote-debugging-failed-to-enable-remote-debuggingexception-from-hresult

  • Anonymous
    August 11, 2014
    In Part 3 of this series we looked at the plumbing required to add support for Web API 2.x to your SharePoint

  • Anonymous
    September 18, 2014
    The comment has been removed

  • Anonymous
    September 19, 2014
    Nice piece of information, I had come to know about your internet site from my friend, and let me tell you, your website gives the best and the most interesting information. This is just the kind of information that I had been looking for, I'm already your rss reader now and I would regularly watch out for the new post, once again hats off to you! Thanks a ton once again, Regards,SharePoint Administration Training in Hyderabad India

  • Anonymous
    September 19, 2014
    Awful piece of information, I had come to know about your blog from my friend, and let me tell you, your blog gives the best and the most interesting information. This is just the kind of information that I had been looking for, I'm already your rss reader now and I would regularly watch out for the new posts, once again hats off to you! Thanks a million once again, Regards,SharePoint Developer Training in Hyderabad India

  • Anonymous
    September 19, 2014
    Awesome piece of information, I had come to know about your website from my friend, and let me tell you, your blog gives the best and the most interesting information. This is just the kind of information that I had been looking for, I'm already your rss reader now and I would regularly watch out for the new posts, once again hats off to you! Thanks a ton once again, Regards,SharePoint Online Training in Hyderabad India

  • Anonymous
    September 19, 2014
    Interesting piece of information, I had come to know about your web-page from my friend, and let me tell you, your blog gives the best and the most interesting information. This is just the kind of information that I had been looking for, I'm already your rss reader now and I would regularly watch out for the new posts, once again hats off to you! Thanks a million once again, Regards,SharePoint Training Institutes in Hyderabad India

  • Anonymous
    January 08, 2015
    m88 : http://m88en.com
    M88.com offer online sports games Asia, Sports Betting Asia, Sports Betting Sites Asia.
    m88asia : http://m88en.net
    Link to M88BET phone: m88en.com. – Register and Open Betting Account and Membership M88BET.
    m88bet : http://www.linkm88vip.com
    MANSION88 the house is one of the largest and most prestigious. Appeared quite early in the Asian market, the so-MANSION88 currently attracts more players.
    link m88 : http://m88wiki.com
    Home the M88 is the official sponsor of the football club in the Premier League
    Wish you happy with the new M88
    m88 casino online : http://m88free.com

    Modern Thai restaurant combines outstanding traditional cuisine and a subtle modern decor with a warm welcoming ambience. Thai Restaurants in Brisbane :http://www.watersidethainoodles.com.au , traveller reviews of Brisbane Thai restaurants and search by price, location, and more..