Life and things around it (WP)

Life experiences, SharePoint, coding issues and photography…

Nuisances of starting developing Apps for SharePoint 2013

with one comment

Recently I was into a SharePoint 2013 overview training. Though the theory was fine, starting the actual App Development was a major hiccup, due to few changes that an experienced SharePoint developer would not expect.

As most of you would know by know, that SharePoint 2013 app development is supported in 2 ways:

But how about the traditional way of development? Where you had SharePoint and Visual Studio and tools, everything locally and do the deployment and testing without much fuss? Remember, setting up a SharePoint developer workstation?

Well, that were the whole thing start getting a little complicated with SharePoint 2013. Let’s get to the story now.

Following the developer environment setup from a TechNet Blog, I created a new Windows Server 2012 VM with 16 GB RAM, a SQL Server 2012 VM, installed SharePoint 2013, installed VS 2012 and Office Developer Tools, had my developer site ready (oh! yes, you need to create a "developer" site because with VS 2012, you cannot deploy to any other site than a "developer" site, though not true for local deployments). Fun enough? More to come…


Mostly when developing on local machine, you are logged in using a single account, which is most likely also local windows administrator as well as system account for SharePoint 2013. That’s how I do it, if you do it differently, I would love to hear why !

Now you have the basic stuff in place, let’s start the App development for SharePoint 2013. I will try to cover the steps to create and deploy a "hello world" app on local SharePoint developer site directly through VS 2012. I would assume that by now you have everything installed on your local machine, including SharePoint 2013.

    1. Make sure you have SharePoint 2013 up and running on your local machine and have a developer site created. Then go ahead and launch VS 2012 and choose to create SharePoint 2013 App Project template.
    2. UAC – This is very thing you would notice (if you are on default UAC settings), even starting to develop the SharePoint 2013 app you need to start in elevated mode. Ok, most of us are now used to UAC prompts, so this gets out of way quickly.
    3. Now you get a familiar dialog asking for the Application name and site where to deploy it for debugging with an additional dropdown, asking for type of application you want to create based on the deployment model you choose. I chose SharePoint-Hosted app model.
    4. Now you are into the development mode and you get the skeleton code for the app in the solution.
    5. So we can just go ahead and deploy the skeleton app. You can directly hit F5 to deploy the app and open the URL or right-click on Project in Solution Explorer and select Deploy.
      But the app did not deploy, rather I got the error:“Error occurred in deployment step ‘Install app for SharePoint’: The System Account cannot perform this action”.

      but isn’t System Account suppose to be the God account in SharePoint?

      This is a security feature in the SharePoint 2013 that you cannot deploy an app using System Account. So what is the alternative?
      Create another account and give permissions, so that it is NOT the system account.

    6. So I did the following:
      • Created a new account in AD as “admin1”
      • Added “admin1” account into Farm Administrator’s group in Central Admin
      • Added “admin1” account as Site Collection administrator to the target developer site
      • Added “admin1” account into local administrators group
    7. After doing the steps, fired up VS 2012 using “admin1” credentials and created a new App for SharePoint 2013.
    8. In the “New App for SharePoint” dialog, I clicked on “Validate” button and this is what I get:
      Rechecked that the user has got Farm Admin permissions and Site Collection administrator roles. But still same error.
    9. I just ignored the error and click on Finish to create the App
    10. Then hit F5 to deploy and I get the following error:
      Error occurred in deployment step ‘Uninstall app for SharePoint’: The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm.

      That reaffirmed that some permissions are missing somewhere, as VS is not able to reach the SharePoint farm itself.
    11. I decided to start by looking into event logs and found this error easily:
    12. SQL database login for ‘SharePoint_Config_2013’ on instance ‘sql08’ failed. Additional error information from SQL Server is included below.

      Login failed for user ‘DEV\admin1’.

    13. Permissions are missing on Config DB, but won’t adding a user to Farm Administrators group give proper permissions? Looks like that is not the case.Then I remembered long ago I had written 1 KB article while at Microsoft, talking about permissions required for SharePoint Object Model.
    14. Next target, add “admin1” user as DBO on Config DB. Go back to SharePoint VM and hit F5 again. A new error pop’s up:

      Error occurred in deployment step ‘Uninstall app for SharePoint’: Cannot connect to the SharePoint site:
      http://sp2013/sites/AppDev/. Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project.
    15. Checking event viewer again revealed, that permissions are also needed on the Content DB for the Site Collection.
    16. Next, added “admin1”  as DB_Owner for Content DB also. Go back to SharePoint VM and hit F5 again. Again a new error pops up:

      Error occurred in deployment step ‘Install app for SharePoint’: We’re sorry, we weren’t able to complete the operation, please try again in a few minutes. If you see this message repeatedly, contact your administrator.
    17. Checked event viewer, now AppMng_Service_DB requires permissions for “admin1” user. Back to SQL and give DB_Owner permissions on AppMng_Service_DB. Back to SharePoint, hit F5.
    18. Voilà! finally the app is deployed and opened up in the browser!

Finally had the sample app up and running after grueling fight with the “new” environment for a few hours! Hope this helps you in the same way… Happy Apps! Smile

Written by Manpreet Alag

March 7, 2013 at 1:13 am

One Response

Subscribe to comments with RSS.

  1. […] when I wrote about my experiences about starting to develop Apps for SharePoint 2013, I got some feedback to consolidate the steps. So here it […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: