Friday, September 4, 2009

Deployment command issues

Scenario:
This is one of the common issues I have seen with people developing solution on single WFE server farm and deploying sharepoint solution to multi-server WFE farm.

"The solution has not been deployed and may require clean up"

Reason:
Though there can be several issues, I am pointing out few here.

1. STSADM -o execadmsvcjobs
Often this command is used after retract solution and deploy solution command. This command executes all administrative timer jobs immediately instead of waiting for the timer job to run. Think of it as a console application with the same code as of Timer Job, only thing is it will run instantly. So far so good. But assuming that this means it has executed the job on all server is not true, which can be very problematic in multi-server farm.

Common Error: The solution-deployment-trainingwebparts.wsp-0 job completed successfully, but could not be properly cleaned up. This job may execute again on this server.

Recommendation : Wait for timer job to execute the deployment/retracting jobs and not to use it at all in deployment /retracting scripts in multi-server farm.

2. IISReset / Application Pool Reset
This command basically restarts the IIS services which is required to make sure web.config / GAC and other XML file based changes done on the file system get picked up.

Recommendation : Make sure you reset IIS / Application pool on all the WFEs

3. Resetting Timer service
net stop "Windows Sharepoint Services Timer"
net start "Windows Sharepoint Services Timer"

This command basically restarts the Timer services, which is required to make sure it picks up the code changes done to Custom Timer Job.

Recommendation : Make sure you reset Timer job on all the WFEs

4.Feature Activation:
Try to keep these commands in separate file or add 30sec pause between deploy solution and feature activation , other you might get error complaining feature is not installed ( on another server ).

Recommendation : Use separate file for these kind of commands.

5.Use of Force attribute:
Lot of times we use Force attribute as a rule of thumb.. :-) , try to understand the need of this attribute.

As per MSDN , using it in UninstallFeature forces an installation of a feature that is already installed and in ActivateFeature it activates a feature. This causes any custom code associated with the feature to rerun.

Recommendation : Try to avoid the use of force attribute and only use it when retracting is not able to clean up the features.

5.Use of AllContentUrls attribute:
You may not have used it directly but if you remember the drop down saying deploy on All Web Applications ? , that what it is.

Don't use this.

Recommendation : Deploying the solution to each of the web application. If you have a lot of Web Applications then you can script it.

2 comments:

Eric Bollinger November 24, 2009 at 12:26 PM  

if you don't use execadmsvcjobs command, how do you know when the timed job executes? how can you batch commands (addsolution then deploysolution) if you don't know if the timer job has executed? if you use the [immediate] parameter, does the job fire immediately?

Sandeep K Nahta November 24, 2009 at 12:29 PM  

Eric , i suggested to add all the solutions ( which is not a timer job operation and get committed right away ) .. only for deploy / retract you should wait and keep an eye in Central Admin > Operation > Solution Management to see if they get deployed/retracted well.

Yes -immediate attribute try to make deployment/retracting as soon as possible ( can take 2-3 min )