Wednesday, April 17, 2013

Visual Studio Can't Start SPUserCodeV4

The day has come at last. Fudging the numbers and being good with people will no longer spare you: it is time to actually do some actual wizarding, in a real IDE.

Horrors await.

First: I'm going through this with a paper book, from WROX, called "Beginning Sharepoint 2010 Development." It's been on my desk for the better part of two years as I put out fires and glared at Google and generally mucked about, but I thought hey, let's do this by the book!

So launch Visual Studio 2010.

Problem 1

You don't have Visual Studio 2010. You have Visual Studio 2007 and ... something Microsoft claims is free or possibly Express, yet insists has had its trial period expired. You need 2010, because there are no pre-established Sharepoint templates in any earlier version, and the odds of getting them to work from the internet are slim indeed. Acquire VS 2010. Make it work. Make someone else pay for it (and pay and pay, all shall pay)....

Build Your First Actual Piece of Code for This Benighted Thing

  1. Launch VS2010.
  2. Launch a new project, sandboxed as per best practices.
  3. Insert a simple webpart.
  4. Click "Build-Deploy" in order to make sure everything's hooked up properly.
    1. Note that VS2010 has instantly thrown an error, related to SPUserCodeV4, which cannot be started.
    2. http://blog.dennus.net/2009/11/18/sp2010-spusercodev4-your-new-web-part-project-isnt-deploying/ According to this, such is normal: You only need to start the service! Go to your central administration and start the service like he says. Except on your server, the service simply doesn't exist. It isn't there! There's no User Code service in place at all
    3. That is because it is not called that any more, it is called Microsoft SharePoint Foundation Sandboxed Code Service.
    4. This will tell you what to do http://stackoverflow.com/questions/3571787/sharepoint-2010-sandboxed-solution
    5. The answer, which should be clear as day, is to go to Central Admin>System Settings>Manage User Solutions> "All sandboxed code runs on same machine as a request."
  5. Click "Build-Deploy" again.
    1. "Error Occured in Retract Solution".
    2. Return to Central Admin.
    3. Restart the web serv-
    4. Gigantic runtime error. Apparently, the backend passwords do not match the passwords in Active Directory.
      • What.
    5. Go to your SysAdmin to fix it by resetting the password.
      • Do not forget an offering of Snax. 
        • Not actual Snax, those were disgusting, try walnut puffs.
    6. Set-SPManagedAccount -UseExistingPassword
    7. New password.
    8. Return to Central Admin, start service. Service starts!
  6. Click "Build-Deploy" again.
Good, everything's working. Now you can poke around happily in Visual Studio, getting a more and more serious sniff at how XML is used everywhere to... not maybe the best ends? This XML business seems pretty complicated, as all committee-driven simplifications inevitably are. The C# looks alright, deep within its safe wrapping of curvy brackets, magic words, and miscellaneous punctuation.

The multiple opening deploy errors have sapped my ability to care about this project. Perhaps if we forget about it for another 18 hours, things will go more smoothly on the build.

No comments:

Post a Comment