开发者

How do I get the exception that caused a Persist action to fail?

开发者 https://www.devze.com 2023-02-13 22:19 出处:网络
I have a st开发者_运维知识库andard WCF service workflow with several Persist actions (all created via UI drag and drop). Most of the persist actions succeed, but one fails.

I have a st开发者_运维知识库andard WCF service workflow with several Persist actions (all created via UI drag and drop). Most of the persist actions succeed, but one fails.

Wrapping the failing Persist action in a Try/Catch block does not help - it just steps over the catch and terminates the workflow.

How do I find the specific reason why the persist failed? Is any exception logged anywhere?

I'm developing on Windows XP.


I log the exception in a file adding a listener to the System.Activities.DurableInstancing namespace, you will be able to see the exception there:

<system.diagnostics>
    <sources>
      <source name="System.Activities.DurableInstancing" switchValue="Verbose">
        <listeners>
          <add name="textListener" />
          <remove name="Default" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="textListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\Log\persistenceproblem.txt" traceOutputOptions="ProcessId, DateTime" />
    </sharedListeners>
    <trace autoflush="true" indentsize="4">
      <listeners>
        <add name="textListener" />
      </listeners>
    </trace>
  </system.diagnostics> 

Here it is explained in my blog http://pablocastilla.wordpress.com/2012/05/18/how-to-analyze-a-workflow-foundation-4-0-persistence-problem/


To get the specific details of the underlying error, run the workflow in debug mode (or attach to w3wp.exe). In Visual Studio, make sure that the "Just My Code" option is NOT enabled in Debug > Options and Settings and make sure you enable Debug > Exceptions > Common Language Runtime Exceptions. Then the IDE will give you the error when you step through.

Thing is - you can't do this on a production server, so not sure how you would get detailed error information in production, if only a high level message is given in the tracking event.


Adding the ETWTracingParticipant should help you see the error in the Windows event log. Something that is often the problem is that some of the state is your workflow is not serializable.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号