Pageflow and transactions

Topics: User Forum
May 8, 2007 at 12:32 PM
I was trying to start a new worklfow and do some other stuff in a transaction but I was unable to start to workflow as it gave me a timeout error.
I also tried with the following simple code just to see what happens when worklfow is started within a transaction:

using(System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope())
{
MyPageFlow.Start();
}

This have resulted in the same error which is:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

Stack Trace:


SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857194
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734806
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
System.Data.SqlClient.SqlDataReader.get_MetaData() +62
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
System.Data.Common.DbCommand.ExecuteReader() +9
System.Workflow.Runtime.Hosting.PersistenceDBAccessor.RetrieveStateFromDB(DbCommand command, Boolean checkOwnership, Guid instanceId) +227
System.Workflow.Runtime.Hosting.PersistenceDBAccessor.RetrieveInstanceState(Guid instanceStateId, Guid ownerId, DateTime timeout) +1349
System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService.LoadWorkflowInstanceState(Guid id) +240
System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance) +607
System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance) +267
System.Workflow.Runtime.WorkflowRuntime.Load(WorkflowInstance instance) +44
System.Workflow.Runtime.WorkflowInstance.GetWorkflowDefinition() +31
Microsoft.Practices.PageFlow.WorkflowFoundation.WorkflowFoundationPageFlowFactory.GetOrCreateDefinition(Type pageFlowType, WorkflowInstance instance) +108
Microsoft.Practices.PageFlow.WorkflowFoundation.WorkflowFoundationPageFlowFactory.GetPageFlow(Type pageFlowType) +49
Microsoft.Practices.PageFlow.WorkflowFoundation.WorkflowFoundationPageFlowProvider.GetPageFlow(Type pageFlowType, Boolean createIfNotExists) +171
Microsoft.Practices.PageFlow.WorkflowFoundation.WorkflowFoundationPageFlowProvider.GetPageFlow(Type pageFlowType) +7
PageFlowTest.Default.getMyPageFlow() in D:\WORK\Sandbox\PageFlowTest\PageFlowTest\Default.aspx.cs:25
PageFlowTest.Default.ButtonStartClick(Object sender, EventArgs e) in D:\WORK\Sandbox\PageFlowTest\PageFlowTest\Default.aspx.cs:36
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

I've tried with two different workflows which all work correctly when there is no transaction scope.
Any ideas?