Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have 3 On-Create SharePoint Designer Workflows which I'd like to run (automatically) when creating items by code, using a WCF service.

At first, no workflows where created at all (the status column was empty). I've changed my WCF Service IIS application pool user not to be the System Account, which solved that problem.

Next, all workflows started in invalid state (Failed on Start). I've finally found a relevant post (Sharepoint workflow created from sharepoint designer failed on start when list item added from asp.net code via object model), which suggested I need to copy the <System.Workflow.ComponentModel.WorkflowCompiler> section in my WCF's web.config file.

Both these actions seemed so solve most of the problems, but, sometimes, few of the workflows still start in "Failed on Start" status and don't run. It's very hard to specify. I have 3 workflows which should start on-create.

  • When I start a new test (after an iisreset or a recycle), very few of the workflows are "Failed on start" (about 3, sometimes it seems as one per workflow column), on one of the first items (I don't create too many, even one item or 3 item)
  • After that, all newly created items work as expected. (I've tested as many as 30 items, all work well)
  • It's possible the environment in configured incorrectly, but it happens on two machines (dev and test), so it is less likely, but possible.

I know it doesn't sound like a proper question, but I hope someone have done something similar and can shed some light on the subject.

share|improve this question
    
<rant> - I've literally wasted days on this silly issue that should just work. I usually don't ask suck broad questions, but I've tried a lot and didn't get far. –  Kobi May 11 '11 at 10:01
    
Oh, I've also tried running the workflows by code, using impersonation as suggested in social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/… , I've had similar results. –  Kobi May 11 '11 at 10:03
    
Do you have any errors in the ULS logs ? –  Bart May 11 '11 at 10:13
    
@Bart - Good call. I actually did look there, but it didn't make much sense to me. Here's what seems relevant: pastebin.com/raw.php?i=wvfazsCP –  Kobi May 11 '11 at 10:27
1  
@Bart - It seems that was the issue. Thanks for pointing me in the right direction. It's funny - I did check the logs, and even compared the <authorizedTypes> element with the one I had, but didn't notice some assemblies are version 12 when they should be version 14. Thanks for the nudge! –  Kobi May 11 '11 at 10:49

1 Answer 1

up vote 2 down vote accepted

The web.config of my WCF service needs the <System.Workflow.ComponentModel.WorkflowCompiler> to create the items and start their workflows properly.

I've had all <authorizedType>s copied from MOSS 2007 by accident, and not SharePoint 2010. Copying that section again from a current SharePoint 2010 web.config file solved the issue.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.