Samoyed

Hello,

My problem is the following: I have an ASP.NET application with a validation workflow inside. It uses the membership and roles mechanisms provided by ASP. In my computer the application works perfect, the workflow starts, does all its job and completes successfully, but when I move the application to another computer the workflow aborts after saving some changes to the database. The workflow starts, gets 2 different events (start and save) and then calls an external method to save changes to database. It saves those changes (I checked the DB and it's OK), and then aborts.

The problem is that when the workflow aborts it doesnt give any exception message, so I have no idea what the problem is, and as it works perfectly in my computer I suppose it must be something to do with the comp configuration. I checked the machine.config and removed the parts referring to membership, roles and profile providers, as I have them in my web.config, but still doesn't work. I don't know what else I can check...

Please give me some advice! Thanks,

Ruben



Re: Windows Workflow Foundation Workflow application working in one comp but not in another

Angel Azcarraga - MSFT

Ruben

Try subscribing to the WorkflowRuntime.ServicesExceptionNotHandled event. What is most likely your issue is that the persistence service is throwing an exception when trying to persist the workflow instance. This causes an abort to occur.

The above mentioned event will be fired whenever the runtime catches an exception from any of the runtime services (including persistence service) and report the exception.

-Angel






Re: Windows Workflow Foundation Workflow application working in one comp but not in another

Samoyed

Hello,

Thanks Angel for your reply. I've tried subscribing to that event, but the workflow still aborts and the ServicesExceptionNotHandled event never comes up, so still have no clue. What you said about the persistence, the thing is that in my computer it works and persists perfectly, problems only occur when I try the program in another computer. But I've tried it in a 3rd computer and it works perfectly too, so I suppose it might be something about the configuration of the comp where it fails... Any ideas

Thanks again,

Ruben





Re: Windows Workflow Foundation Workflow application working in one comp but not in another

kushals

Try the following -

1. Look at the EventLogger to check for any errors since you strongly feel it has something to do with your machine.

2. Also subscribe to the WorkflowAborted eventhandlers and that might give you a better idea as to where the exception is happening.

3. Enable Tracking and Tracing and that should also help.

Thanks,

Kushal.






Re: Windows Workflow Foundation Workflow application working in one comp but not in another

Samoyed

Hi Kushal,

Thanks for your help, but I'm not too experienced in this. How do I check the EventLogger I already subscribed to the WorkflowAborted event, thats how I know that the workfow aborts, but the problem is that it doesn't give an exception message like other events (WorkflowTerminated, etc).

¡¯Thanks,

Ruben





Re: Windows Workflow Foundation Workflow application working in one comp but not in another

kushals

The EventLogger is the Windows Event Logger. It can be seen at -

Start - Control Panel- Administrative Services - Event Viewer.

Also try using WF Tracking and Tracing to figure out whats going on exactly. The WF samples have good starting points for Tracking and Tracing.

Hope this helps!

Thanks,

Kushal.






Re: Windows Workflow Foundation Workflow application working in one comp but not in another

Tom Lake - MSFT

Try adding the following to your app.config file:

<system.diagnostics>

<switches>

<add name="System.Workflow LogToTraceListeners" value="1" />

<add name="System.Workflow.Runtime.Hosting" value="All" />

<add name="System.Workflow.Runtime" value="All" />

<add name="System.Workflow.Runtime.Tracking" value="All" />

<add name="System.Workflow.Activities" value="All" />

</switches>

<trace autoflush="true" indentsize="4">

<listeners>

<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="WFTrace.log" />

</listeners>

</trace>

</system.diagnostics>

This will create file named WFTrace.log in your bin\debug folder if debugging in VS and in the same directory as your exe if your are running it directly.






Re: Windows Workflow Foundation Workflow application working in one comp but not in another

Samoyed

Hello,

Thanks for the answer, Tom. I hadn't been able to try it until now, because the conflictive computer wasn't available. Now I've tried it and while checking the WFTrace.log I've found the following exception:

System.Workflow.Runtime Critical: 0 : Uncaught exception escaped to the root of the workflow.
    In instance 561fbbc9-3248-4cfa-9243-b6b8bbf8ed71 in activity
Inner exception: System.Workflow.Runtime.Hosting.PersistenceException: Este flujo de trabajo no es propiedad de WorkflowRuntime. La propiedad de WorkflowRuntime ha caducado o el flujo de trabajo es propiedad de otro WorkflowRuntime. ---> System.Workflow.Runtime.WorkflowOwnershipException: Este flujo de trabajo no es propiedad de WorkflowRuntime. La propiedad de WorkflowRuntime ha caducado o el flujo de trabajo es propiedad de otro WorkflowRuntime.
   en System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService.System.Workflow.Runtime.IPendingWork.Commit(Transaction transaction, ICollection items)
   en System.Workflow.Runtime.WorkBatch.PendingWorkCollection.Commit(Transaction transaction)
   en System.Workflow.Runtime.WorkBatch.Commit(Transaction transaction)
   en System.Workflow.Runtime.VolatileResourceManager.Commit()
   en System.Workflow.Runtime.WorkflowExecutor.DoResourceManagerCommit()
   en System.Workflow.Runtime.Hosting.WorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)
   en System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)
   en System.Workflow.Runtime.WorkflowExecutor.CommitTransaction(Activity activityContext)
   en System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)

Translating the exception into English, it means something like "This workflow isn't owned by WorkflowRuntime. The ownership of WorkflowRuntime has expired or the workflow is owned by another WorkflowRuntime." The problem is that it doesn't make sense to me, as it can't be a problem with the code or with the workflow design, because the same program works perfectly in another computer. It might have to be something about the configuration, but I don't know what... I also found some more interesting information in the log file:

System.Workflow.Runtime.Hosting Information: 0 : SqlWorkflowPersistenceService(a4a8925b-a9b1-4cc7-b37e-9fa62cebba5a): inserting instance: 561fbbc9-3248-4cfa-9243-b6b8bbf8ed71, unlocking: True database: AreaInformatica
System.Workflow.Runtime.Hosting Information: 0 : SqlWorkflowPersistenceService(a4a8925b-a9b1-4cc7-b37e-9fa62cebba5a): owership violation with a4a8925b-a9b1-4cc7-b37e-9fa62cebba5a on instance 561fbbc9-3248-4cfa-9243-b6b8bbf8ed71
System.Workflow.Runtime Error: 0 : SqlWorkflowPersistenceService(a4a8925b-a9b1-4cc7-b37e-9fa62cebba5a): Exception thrown while persisting instance: Este flujo de trabajo no es propiedad de WorkflowRuntime. La propiedad de WorkflowRuntime ha caducado o el flujo de trabajo es propiedad de otro WorkflowRuntime.

If I understand it right, it seems to have a conflict with another runtime that is holding the instance, but both runtimes seem to have the same GUID, so they're the same one. Anyways I don't think there can be two different runtimes as the program works in other computers.

Any help will be welcome. Thanks,

Ruben

 





Re: Windows Workflow Foundation Workflow application working in one comp but not in another

Samoyed

Hi again,

Excuse me, I already found the solution to my problem in another post that I hadn't seen when I searched in the forums the first time. Apparently the problem was that the workflow took longer to do its operation than the ownership interval, so when the runtime tried to persist it, it didn't belong to the runtime any more, as it is explained in this post:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1069003&SiteID=1

So I changed the ownership duration to Timespan.MaxValue and it works now. But there's something I don't understand: I hadn't changed the ownership duration since the first day I started using the persistence service, and I never had that problem until 2 days ago. And since then I've had it every time I try the workflow. So I don't understand how my previous ownership duration was enough until 2 days ago and isn't enough since then... If anyone has some explanation about it I'll be happy to hear it

Thanks,

Ruben





Re: Windows Workflow Foundation Workflow application working in one comp but not in another

Tom Lake - MSFT

What did you previously have the ownership duration to Was the first computer faster than the second Ownership duration should be set to the amount of time needed from when the runtime picks up the workflow until it is persisted again, plus a little extra in case things run slow. If the runtime attempts to persist after the timeout has expired you will get the exception you are getting. Timespan.MaxValue works because this gives the instance of the runtime that is working on the workflow as much time as needed. However, if you host was to crash before the workflow became idle again and is persisted you will not be able to restart the workflow from the last persistence point since it will still be marked as owned.