Error occurred in deployment step ‘Activate Features’ Sharepoint 2010

This error cause by Visual Studio’s default deployment step configuration because it use the -local option when deploying…. thats why it dont create timer job to deploy on other server…

You can fix it by creating your own deployment step or use stsadm command and creating a batch file like me.

For more info for creating your own deployment steps:
http://msdn.microsoft.com/en-us/library/ee256698.aspx

You should consider fallowing advices:

1) As farm deployment to multiple servers requires a timer job you will need to pause the deployment steps and wait for the timer job to complete (which will no doubt require a constant poll of the timer job status to check whether it has completed or not)

2) Make sure you account for the timer job completing but the solution failing it’s deployment – replying solely on the timer job status will not be a sure fire way of determining whether the solution has actually deployed succesfully

3) Ensure that the account performing the VS Deloyment has enough rights to create the timer job and deploy cross farm
Resources:
http://www.go4answers.com/Example/error-occurred-deployment-step-32423.aspx

Here is an example deployment cmd

@echo Deploying NSF2010 solution
 
@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN;%PATH%
 
@if "%1"=="" (goto invalidParameters) 
 
stsadm -o deactivatefeature -name NSFBase_NSFBase -url %1 -force
stsadm -o deactivatefeature -name NSFBase_NSFErrorModuleFeature -url %1 -force
 
stsadm -o uninstallfeature -name NSFBase_NSFBase -force
stsadm -o uninstallfeature -name NSFBase_NSFErrorModuleFeature -force
 
stsadm -o retractsolution -name NSFBase.wsp -immediate -url %1
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name NSFBase.wsp -override
 
stsadm -o addsolution -filename NSFBase.wsp
stsadm -o deploysolution -name NSFBase.wsp -immediate -allowgacdeployment -force -url %1
stsadm -o execadmsvcjobs
 
stsadm -o installfeature -name NSFBase_NSFBase -force
stsadm -o installfeature -name NSFBase_NSFErrorModuleFeature -force
 
stsadm -o activatefeature -name NSFBase_NSFBase -url %1
stsadm -o activatefeature -name NSFBase_NSFErrorModuleFeature -url %1
 
@goto endOfBatch
 
:invalidParameters
	@echo Please call with the correct parameters.
	@echo The correct syntax of this command is:
	@echo Deploy [siteurl]	
 
:endOfBatch

Usage:

run cmd  with administrative rights then type

deploy [http://your site url:port]

 

Happy Codding.

Administrative service for this server is not enabled when deploy

Full error is:

The timer job for this operation has been created, but it will fail because the administrative service for this server is not enabled. If the timer job is scheduled to run at a later time, you can run the jobs all at once using stsadm.exe -o execadmsvcjobs. To avoid this problem in the future, enable the Windows SharePoint Services administrative service, or run your operation through the STSADM.exe command line utility.

Here is the solution :

Go to Start > Run and Type services.msc

Now in Services window select “SharePoint 2010 Administration”Right click and start

Thats it.

Sharepoint 2010 Access Denied when modifing web.config with ApplyWebConfigModifications()

Ok i accept this problem is one of my favorite. After 3 hours finally i found a solution .Let me describe the error first. I have a feature receiver class which makes web.config modifications but SPWebApplication.ApplyWebConfigModifications() method cause an access denied error in activation process.Here is my code :

public override void FeatureActivated(SPFeatureReceiverProperties properties)

{

bool bApplyChanges = ApplyWebConfigMods(properties);

SPSite currentSite = properties.Feature.Parent as SPSite;

if (bApplyChanges)

{

SPWebApplication currentWebApp = currentSite.WebApplication;

string sClassName = typeof(NSF.Modules.ErrorModule).FullName;

SPWebConfigModification moduleEntry = addHttpModule(“NFSErrorModule”,

“NFSErrorModule”, PreConditions.integratedMode, sClassName, 1);

currentWebApp.WebConfigModifications.Add(moduleEntry);

//currentWebApp.WebService.ApplyWebConfigModifications();

SPFarm.Local.Services.GetValue<SPWebService>().ApplyWebConfigModifications();

currentWebApp.Update();

}

}

First i changed currentWebApp.WebService.ApplyWebConfigModifications()  to SPFarm.Local.Services.GetValue<SPWebService>().ApplyWebConfigModifications();

Secondly i gave permission read/write Network Service user which is my apppool identity for wss folder where web.config in it.

Third I ran powershell commadlet that change RemoteAdministratorAccessDenied propterty to false . i found it in below url
http://unclepaul84.blogspot.com/2010/06/sppersistedobject-xxxxxxxxxxx-could-not.html

function Set-RemoteAdministratorAccessDenied-False(){ # load sharepoint api libs [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) > $null [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Administration”) > $null
# get content web service $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService  # turn off remote administration security $contentService.RemoteAdministratorAccessDenied = $false  # update the web service $contentService.Update()  }

For more info:
http://stefvanhooijdonk.com/2010/08/02/custom-spjobdefinition-and-access-denied-error/
http://blogs.msdn.com/b/navdeepm/archive/2010/09/15/sharepoint-2010-adding-nested-web-config-entries-using-the-spwebconfigmodification.aspx

and now its ok.

by the way default value of RemoteAdministratorAccessDenied property is totally sucking idea.And so shouldnt be someone code it with throwing explanatory exception ?

Have a nice codding…

Sharepoint 2007 & 2010 Execution Timeout

Sometimes your code needs  time to execute and sharepoint throw an error about Timeout .  here is the solution:

Add this config line to your web.config.

<httpRuntime maxRequestLength=”51200″ executionTimeout=”1200″/>

MSDN say for executionTimeout : Optional Int32 attribute.Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET.

This time-out applies only if the debug attribute in the compilation element is False. If the debug attribute is True, to help avoiding application shut-down while you are debugging, do not set this time-out to a large value.

The default is 110 seconds. If you set executionTimeout 1200 means 20 minutes.

Here’s the complete syntax for this tag:

<httpRuntime executionTimeout=”seconds”
maxRequestLength=”kbytes”
minFreeThreads=”numberOfThreads”
minLocalRequestFreeThreads=”numberOfThreads”
appRequestQueueLimit=”numberOfRequests”
useFullyQualifiedRedirectUrl=”true|false”  />

This time-out applies only if the debug attribute in the compilation element is False. when set to “debug=true” mode, the runtime will ignore the timeout setting.

Important note: If you are working with application pages in Layouts folder you should change web.config of this folder not your application folder.

If you want to use this attribute for one page your config should be like this

<location path=”MyPages/TestPage.aspx”>
<system.web>
<httpRuntime
executionTimeout=”1200″
maxRequestLength=”51200″ />
</system.web>
</location>

Happy tips..

HTTP 500 – Internal server error page Sharepoint 2007

You can get more detailed error open debug functionality in web config

  • In the <system.web> tag, locate the <customErrors mode=”On”> tag and change it to <customErrors mode=”Off”> to see the ASP.NET exception when an error occurs instead of being redirected to the error page.
  • In the <SharePoint> tag, locate the <SafeMode MaxControls=”50″ CallStack=”false”/> tag and change it to <SafeMode MaxControls=”50″ CallStack=”true”/>. This causes the ASP.NET error message to display with stack trace information
  • In my case error caused by Language pack . You should check your server version and service packs also .

    See :

    https://blog.bugrapostaci.com/2010/10/21/sharepoint-2007-language-pack-service-pack-order/

    See you now.