No available sandboxed code execution server could be found

by James 11. June 2011 12:39

Silly me!  I thought I’d get through Sharepoint 2010 - ‘hello world’ without any bumps.  But, of course, when I went to add my newly created webpart to my newly created page, I was treated to this little reminder of what I should well expect after fourteen years of Microsoft programming.

After four hours of searching, several ineffective antidotes, and a lot of valuable education, my aggravation was finally relieved by an amalgam of all aforementioned prescriptions.  I did exercise scientific method, so I can offer this with some confidence.  

Mine is a Windows 7 “development” install, which was done well after VS2010 + all applicable windows updates.

Symptoms

  • Event Log Entries
    • Event ID: 7034
    • “The Sharepoint 2010 User Code Host service terminated unexpectedly.  This has happened n times.
  • ULS Log Entries – log path should be “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS”
    • Performance Counter OS (pdh) call failed with error code PDH_INVALID_HANDLE.
    • PDH failure on counter \MachineName\ASP.NET\\Requests Current with error Unknown error (0xc0000bbc)
  • SharePoint 2010 User Code Host Service will not start (the event log isn’t lying).

Resolution

The issue seems to be because SharePoint is unable to create the performance counters for its process.  While the authors of the various blogs that I encountered seemed to have rather isolated symptoms, I was lucky to have a bit of several…

  • Make Sure the account under which the Sharepoint 2010 User Code Host Service is running is in the following groups.  After doing so, stop and start the SharePoint 2010 User Code Host Service.
    • Performance Monitor Users
    • WSS_WPG
    • WSS_ADMIN_WPG
  • The service account should have write access to the logs directory
    • “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS”
  • The service account should be that which was configured during install.  I understand that SharePoint also makes other assumptions based on that account, so that if you were to change it – as some suggest – to an account with greater privilege, you will likely encounter other issues.
  • Check that your performance counters are set-up properly
    • The registry key HKLM\Software\Microsoft\Windows NT\CurrentVersion\Perflib\009 should contain three entries (Default), Counter and Help
    • You should have a file named perfc009.dat in c:\windows\system32.
    • If these conditions aren’t satisified, run the following command from you VS2010 command prompt.  lodctr /r
  • The value for “Disable Performance Counters” under registry key HKLM\System\CurrentControlset\services\PerfProc\Performance should be 0.

Yes, my configuration violated all of these; I don’t know what I did so terribly wrong during my install, other than assuming that Microsoft’s installer would do its job.  Bitter, I know, yet I’ll keep on sharpening my axe, as it were, with Microsoft’s toolset.

Tags:

SharePoint 2010 | .NET

System.Web.DataVisualization Missing

by James 28. May 2011 12:00

Installing Sharepoint Server 2010 on a Windows 7 Client for development purposes, you get the following error during configuration.

Could not load file or assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

To fix… make sure you have .NET Framework 3.5 installed.

 http://www.microsoft.com/downloads/details.aspx?FamilyID=
AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en

And the MSChart Component

http://www.microsoft.com/downloads/details.aspx?familyid=
130F7986-BF49-4FE5-9CA8-910AE6EA442C&displaylang=en

Tags:

.NET | SharePoint 2010

The LINQ between Reactive Extensions and Monads.

by James 18. January 2011 06:29

First, take a look at this code.  Take it in… feel it… be it.

   1:      public class Identity<T>
   2:      {
   3:          public T Value { get; private set; }
   4:          public Identity(T value) { this.Value = value; }
   5:      }
   6:   
   7:      public static class IdentityExtensions
   8:      {
   9:          public static Identity<T> ToIdentity<T>(this T value) 
  10:          { 
  11:              return new Identity<T>(value); 
  12:          }
  13:   
  14:          public static Identity<V> SelectMany<T, U, V>
  15:              (this Identity<T> id, Func<T, Identity<U>> k, Func<T, U, V> s)
  16:          {
  17:              return s(id.Value, k(id.Value).Value).ToIdentity();
  18:          }
  19:          public static Identity<U> SelectMany<T, U>
  20:              (this Identity<T> id, Func<T, Identity<U>> k) 
  21:          { 
  22:              return k(id.Value); 
  23:          }
  24:      }

The code below exercises the classes above, so from it you should get a general idea of what’s going on, if you hadn’t already a clue.

   1:      class Program
   2:      {
   3:   
   4:          static void Main(string[] args)
   5:          {
   6:   
   7:              var r = 5.ToIdentity()
   8:                  .SelectMany(x => 6.ToIdentity(), (x, y) => x + y);
   9:   
  10:              var b = from x in 5.ToIdentity()
  11:                      from y in 6.ToIdentity()
  12:                      select x + y;
  13:   
  14:              Console.WriteLine(r.Value);
  15:              Console.WriteLine(b.Value);
  16:   
  17:              Console.ReadKey();
  18:   
  19:          }
  20:      }

This code frightens me; not terrifically, but enough to keep me honest and humble.  As it were, I see only code; I don’t see the blonde, brunette or the redhead.  I can discern the LINQ, extension methods, lambda expressions and generics, but there is obviously something bigger happening…. magic, if you will.  Now I don’t believe in magic, but I am certainly willing to call it that if it saves me from the spiraling rabbit hole that an educational journey often becomes.  And I’ll admit, LINQ has always been magic.

Now you might be asking yourself what all this has to do with Reactive Extensions (Rx).  If so, then great!  This isn’t pointless.  If you are unfamiliar with Rx, follow the link… I don’t regurgitate.  Better yet, go to  Erik Meijer’s intro, which should pique your interest.  If you are familiar with Rx and have explored the  Hands on Lab, then you clearly didn’t follow the rabbit on page 8.

The code represents monads, which are apparently the theory behind LINQ, which is fundamental to Rx.  In fact, some suggest that LINQ should have been called Language INtegrated Monads.  I wish it were.  My mind always wants to draw a direct correlation to query in the SQL sense, but Query in the LINQ sense has more to do with functional programming.  I extracted this code from Wes Dyer’s blog entry on  The Marvels of Monads  If monads are new to you, or you don’t get the fundamentals of LINQ, I highly recommend following through the steps in the article; don’t just cut and paste my reduction.  if you’re hoping for an explanation of Monads, I don’t think it can be done, as Wikipediahas so generously proven; bring some Excedrin along for the journey.  I think it is just something you have to ‘get’, and I think Wes’ article presents it in such a manner.

The journey from Rx to monads included many more resources; I’ve reference only the ones that I believe helped me gain a fundamental understanding of LINQ.   The others were just static.

Tags:

Monads | .NET | Reactive Extensions | Monads | Rx | Reactive Extensions | Rx

Advertisement

RecentPosts