Today’s
article is based on Sandboxed Solution. By means of this article, I am going to
share some issues that I faced while activating the solution as well as adding
the webpart on SharePoint site.
So
basically what is Sandbox solution?
When
we talk about ‘solution’ then only one term which will comes to your mind i.e.
WSP (Windows Solution package). People often misunderstood this Sandboxed concept
as something is going to affect the farm, the scope is based on web
application, and it’s going to reset the IIS app pools but let me tell you the
fact – Sandboxed solution are user code solutions. Now again the new
terminology – what is ‘user code solution’?
One
process leads to understand a new process- isn’t it interesting? J
User
code solution means user himself can deploy this solution and activate it and
does not required SharePoint administrator to deploy. This is a very fine
concept in which the scope is restricted to the specific site collection only. I
don’t want to talk about ‘farm Solutions’; otherwise this will misinterpret the
purpose of this article.
Why
Sandboxed solutions are so important:
Sandboxed
solutions do not run in the IIS worker process, neither the IIS application
pool nor the IIS server must restart.
It
is not necessary for the SPUCWorkerProcess process to recycle to load the
latest version of the solution.
Problem
description:
One
user opened a ticket by saying ‘he needs to deploy some package’. Further probing,
I came across that he has a WSP file and wanted to use as Sandboxed.
Now
the question is – How to configure Sandboxed if it’s not there in your farm?
Here
are the details steps:-
Section: 1
1. Open
Central administration
2. System
settings
3. Under
Servers
4. Manage services
on server
5. Activate this
service “Microsoft SharePoint Foundation Sandboxed Code Service”
Section: 2
1. On the
same server which is hosting the Sandbox code service
2. Click on ‘start’
3. Administrative
tools
4. Services
Once
this configuration done then you are ready to upload the WSF file to the
solution gallery. – Where is this
solution gallery?
·
Open your SharePoint site
·
Site actions
·
Site settings
·
Under galleries
Note:
Make sure you have site collection admin access to upload the solution in the solution
gallery.
Once
the solution gets uploaded then you can activate that solution.
How to
activate it?
-> Click on the solution dropdown -> you will get the option of activate.
In
my case, user was trying to add a webpart on the home page of the site but as
soon as I select the webpart to add then boom! It throws an error message as
following-
Sandboxed code execution request failed.
Let
me tell you some story behind this: I have enabled the service only on the app
server and not on the web front ends. So basically if I activate any service on
app then it does not necessary to activate it on the other servers (WFE’s) – do
you support this fact? – would like understand your views!
I
negotiated my thoughts for a moment and started the service on rest of the
front ends but then a different error comes into picture: see the following-
The Sandboxed code execution request was refused because the
sandboxed code host service was too busy to handle the request.
I
started exploring the CA, site collection features, site manage features and
one link which caught my attention, that is – Manage User Solutions
Where is
this link?
·
Open the Central administration
·
System settings
·
Manage user solutions
Once
you will open this section then you will get two options:
·
All sandboxed code runs on
the same machine as a request.
·
Requests to run sandboxed
code are routed by solution affinity.
It
took some time for me to understand these terminologies as by practical only
you will come to know the actual results.
See
the differences:
All sandboxed code runs on the same machine as a request: Sandboxed
Code Service should be started on all the WFE’s.
Requests to run sandboxed code are routed by solution affinity:
if you start the “Sandboxed Code Service” on app server only then also it’s
fine.
So
I stick with my logic and select the second point i.e. Requests to run
sandboxed code are routed by solution affinity and disabled the service from
rest of the front ends.
But
the error is still there! I checked the logs, restarted the sandboxed code
service, restarted the user code service but still didn’t make any difference.
Then
here is the rescue
– In our case we checked the state key value and ours was- 0x00023c00
Actual Resolution:
a) On the
server, click Start | Administrative Tools | Services.
b) On the
Services dialog, scroll to SharePoint 2010 User Code Host.
c) Note the
full user name in the Log On As column. You will need this information later.
d) Open
SharePoint Management Shell.
e) Enter the
following at the command prompt, including all punctuation.
f) (Get-SPManagedAccount
–Identity “username”).Sid.Value
g) Replace
username with the name you obtained in step 3. E.g., Domain\FarmAdmin
h) This will
return the user’s SID (Security ID), which you will use in a later step.
i)
Open the registry editor and navigate to:
j)
HKEY_USERS\SID you obtained
earlier\SOFTWARE\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\SoftwarePublishing
k) Be sure
the State key value is set to 0x00023e00.
l)
Restart the sandboxed host service on all
servers on which it is to run.
No
need of server restart as well as IIS RESET.
Check
the results and you will be good.
If you find a different solution, please share as a comment so
that everybody will get the benefit of the same.
If
you have any queries/questions regarding the mentioned information then please
let me know. I would be more than happy to help you as well as resolves your
issues, Thank you.
And it works !!! :) , And Congrats for your 1000th blog post :) :) ..keep going Amol ....
ReplyDeleteThanks Basith :)
DeleteWorks fine for me! Thanks
ReplyDeleteif my dynamics crm is on another virtual machine and SharePoint is on another virtual machine and the same error is occurring , what will be the solution
ReplyDeletei have two vm installed in the system one has crm and one has share point
Hi i have the same issue, but only on a SharePoint server 2013 not on 2010, does it make a difference ? or should the same solution above work as well? Thank you.
ReplyDelete