ms crm 4.0 custom workflow in waiting state
-
Donnerstag, 1. März 2012 07:04
Hello Everyone,
I have developed a custom workflow in MSCRM 4.0. I am logging some of the basic information on the server disk in my workflow. I have tested the process and the workflow seems working fine implementing the required functionality.
I have been monitoring the workflow jobs and found some of the jobs are in waiting state. I debugged it and found the below error:
Workflow paused due to error: Unhandled Exception: System.IO.IOException: The process cannot access the file 'E:\CustomLog\Workflow\logfile_20120201_002031.txt' because it is being used by another process. at Utility.Logger.WriteLog(LogType LogTextType, String LogText) at Workflow.TestWorkflow.ProcessLogic.ProcessOwner(IWorkflowContext context) at Workflow.TestWorkflow.AssignOwner.Execute(ActivityExecutionContext context) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.CompositeActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutionFilter.Execute(Activity activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.FaultAndCancellationHandlingFilter.Execute(Activity activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run()
This happens only when we run the workflow on multiple records at some times. How can I overcome this situation?
Perfectionist
Alle Antworten
-
Donnerstag, 1. März 2012 17:40Moderator
Hello,
Try to use lock statement for file access operations - http://msdn.microsoft.com/en-us/library/c5kehkcz%28v=vs.100%29.aspx
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)