views:

172

answers:

1

Deploying to sharepoint using the object model or STSADM commands sometimes results in one or more packages being in the "error" state in the web control, a redeploy instantly fixes this, usually, even stranger, if i create two apps one which adds and one which deploys then i get no problems, but putting a delay between a single program does not have a similar effect.

If i run the deploy twice for programs which did not deploy successfully it works fine, as long as I do not try to do it programatically in which case it makes no difference.

It is different files and sometimes is none.

I do use stsadm -execadmsvcjobs between add and deploy and even between two of the deploy bunches. (i'm deploying around 10 wsp files programatically)

Does anyone have any ideas on why this happens? or how to solve it, as when i get to implementations it causes problems.

+1  A: 

The problem lies in the fact that sharepoint will perform app pool recycles and / or full iisresets, as well restarts of the SharePoint Timer Service (altough not completely sure about that though). When you try to actually deploy the just installed package sharepoint is still busy getting up and running again, the timer job created to install / deploy is basically waiting for the central admin app pool to be fully running again.

The same thing happens (somewhat reproducably) while retracting a solution. Hit F5 a lot of times on the solution management page while the retract process is underway and if you refreshed fast enough it will hang and display "error" in red.

My solution was to create a WebRequest to at least the central admin (or just do a SPSite = new SPSite("centraladminurl")) in your deployment app or in powershell. Do this after every deploy action as well.

This SHOULD fix the timing issue (basically a kind of "race condition").

Colin
After every solution.deploy command i added a line as follows: SPSite temp = new SPSite(centralAdminURL); temp.Dispose();However running the add and deploy routine still leaves random amounts of error state solutions.You mention that for you creating a webrequest to the central admin worked, how exactly would I do this from my code? Do you have anything that worked for you? Many thanks!
Nathan