Today I was working on a clients Sharepoint site and we had to upload a bunch of files and kick off a workflow through code for each file. I was able to upload the files fine and start the workflow, but the workflow would always be stuck and its state would say that it was "Starting". I knew that the workflow itself wasn't the problem because I could manually start the workflow from the UI and it would run through successfully.
Since we were using a custom 3rd party Sharepoint workflow package, Nintex Workflow 2007, I figured I would try a vanilla built in Sharepoint workflow. So I tried to create an Approval workflow. I got to the page which lets you select the type of workflow, the name, etc. When I hit the next button though, I was given a page that said "The form cannot be displayed because session state is not available". Needless to say I was LESS than pleased.
After some searching of the web I found out that a lot of the times you'll get this message if you don't have a Sharepoint Shared Services Provider (SSP) created and active. I opened my Sharepoint Central Administration site and looked under the "Shared Services Administration" on the left hand nav bar. Sure enough, nothing was listed, so I went to the "New SSP" on the toolbar to create a new one. I followed the steps (you can search the web for more detailed explanation of all the configuration settings, etc. for a Shared Services Provider) and created a new Shared Services Provider. It took a REALLY long time, I mean REALLY long time, like 10 minutes long. Once it was done it told me it encountered an error and that it would continue to try and create the SSP but I would have to fix the problem why it wasn't created. Of course, I had no damn clue why it didn't create successfully in the first place!
When I looked at the screen for the SSP's, I saw the one I created, but it said "(Provisioning in Progress)" next to it. So I let it go for about an hour to see if just needed more time. As with everything else that day, nothing worked. So I set out on the web again. Turns out that if you don't have the "Windows Sharepoint Services Timer" running, the "Provisioning in Progress" message will never go away, and your Shared Services Provider will never 100% finish being created.
There are a few ways you can make sure that the "Windows Sharepoint Services Timer" is active and running.
1) Click the Start Button, All Programs, Microsoft Office Server, and select Sharepoint Products and Technologies Configuration Wizard. Once you start the wizard follow the steps and it will run through the configuration and in addition to other things, it will Start the "Windows Sharepoint Services Timer".
2) This is probably the easiest way. Open a command prompt and type
NET STOP “Windows SharePoint Services Timer Service”
NET START “Windows SharePoint Services Timer Service”
After your done and the SSP finishes "Provisioning", you should see a screen similar to the screenshot below (your sites/ports will obviously be different)
I also read that a lot of people stop the “Windows SharePoint Services Timer Service” because it eats up a lot of ram and apparently has a known memory leak. So some people just start/stop it as needed or setup a monitor using Microsoft Operations Manager (MOM) to restart the service once the memory hits a certain threshold.
So after all the above, I was able to successfully create the Shared Services Provider (SSP). After that, I was then able to enable session state for my sites. So now I was back to my original problem, the workflow's stuck in a "Starting" state after being set to run through code. I reran my app which uploaded the files and kicked off the workflow's. They files still showed "Starting" next to them. I decided to take a quick walk instead of breaking my computer.
Luckily when I came back I refreshed the page and the workflow's showed their status as "Completed"! I decided to rerun my app again and this time watch the Task Manager. Once the files were uploaded, and the workflow's set to run, after a minute or so I saw the processor/ran spike, I refreshed the page, and the workflow's were changing their status's to "Completed" as each was done.
So the “Windows SharePoint Services Timer Service” apparently tells the workflow manager to start up any workflow's that have been set to run. Running the workflow's manually must force the workflow manager to execute, whereas through code it does not.
0a50baf8-9f68-4824-bb7a-1ef195a9feaa|0|.0