WWF:SqlWorkflowInstanceStoreBehavior与SqlWorkflowInstanceStore [英] WWF: SqlWorkflowInstanceStoreBehavior verus SqlWorkflowInstanceStore

查看:116
本文介绍了WWF:SqlWorkflowInstanceStoreBehavior与SqlWorkflowInstanceStore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows服务,其中包装了WCF服务,该服务包含一个运行Activity的WorkflowApplication.我还配置了SQL Server 2008 Express(我知道它正在接近EOL,但文档明确指出仅支持SQL Server 2005或SQL Server 2008)来承载数据库和连接起作用.更清楚地说:Activity的整个过程完成并收到返回值(我通过包装在PowerShell中的WCF客户端调用它).

I have a Windows Service wrapping a WCF Service, which contains a WorkflowApplication, which runs Activities. I have also configured SQL Server 2008 Express (I know, it's approaching EOL, but the documentation explicitly states that only SQL Server 2005 or SQL Server 2008 are supported) to host the database and the connection works. To be even clearer: The entire process of the Activity completes and receives the return (I'm calling it via the WCF client wrapped in PowerShell).

我遇到的问题是,我已经在WorkflowApplication的ServiceHost SqlWorkflowInstanceStore上配置了SqlWorkflowInstanceStoreBehavior.这些都不会引发SQL异常,但是我认为 ServiceHost占有优势,因为我所看到的只是LockOwnersTable上的一个单一条目.

The issue that I'm having is that I've configured SqlWorkflowInstanceStoreBehavior on the ServiceHost and SqlWorkflowInstanceStore on the WorkflowApplication. Neither of these throws a SQL exception but I think that the ServiceHost is taking precidence, as all that I can see is a singe entry on the LockOwnersTable.

Windows服务中的代码:

Code from Windows Service:

        this.obj = new ServiceHost(typeof(WorkflowService));
        SqlWorkflowInstanceStoreBehavior instanceStoreBehavior = new SqlWorkflowInstanceStoreBehavior("Server=.\\SQL2008EXPRESS;Initial Catalog=WorkflowInstanceStore;Integrated Security=SSPI")
        {
            HostLockRenewalPeriod = TimeSpan.FromSeconds(5),
            InstanceCompletionAction = InstanceCompletionAction.DeleteNothing,
            InstanceLockedExceptionAction = InstanceLockedExceptionAction.AggressiveRetry,
            InstanceEncodingOption = InstanceEncodingOption.GZip,
            RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2)
        };
        this.obj.Description.Behaviors.Add(instanceStoreBehavior);
        this.obj.Open();

WCF服务/工作流应用程序中的代码:

Code from WCF Service/WorkflowApplication:

        SqlWorkflowInstanceStore newSqlWorkflowInstanceStore = new SqlWorkflowInstanceStore("Server=.\\SQL2008EXPRESS;Initial Catalog=WorkflowInstanceStore;Integrated Security=SSPI")
                                                        {
                                                            EnqueueRunCommands = true,
                                                            HostLockRenewalPeriod = TimeSpan.FromSeconds(5),
                                                            InstanceCompletionAction = InstanceCompletionAction.DeleteNothing,
                                                            InstanceLockedExceptionAction = InstanceLockedExceptionAction.BasicRetry,
                                                            RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(5)
                                                        };
        InstanceHandle workflowInstanceStoreHandle = newSqlWorkflowInstanceStore.CreateInstanceHandle();
        CreateWorkflowOwnerCommand createWorkflowOwnerCommand = new CreateWorkflowOwnerCommand();
        InstanceView newInstanceView = newSqlWorkflowInstanceStore.Execute(workflowInstanceStoreHandle, createWorkflowOwnerCommand, TimeSpan.FromSeconds(30));
        newSqlWorkflowInstanceStore.DefaultInstanceOwner = newInstanceView.InstanceOwner;

        // Now stage the WorkflowApplication, using the SQL instance.
        AutoResetEvent syncEvent = new AutoResetEvent(false);
        WorkflowApplication newWorkflowApplication = new WorkflowApplication(unwrappedActivity)
                                                         {
                                                             InstanceStore = newSqlWorkflowInstanceStore
                                                         };

问题:

  1. ServiceHost是否在WorkflowApplication上SqlWorkflowInstanceStoreBehavior 覆盖 SqlWorkflowInstanceStore?如果是这样,显而易见的答案是删除ServiceHost上的SqlWorkflowInstanceStoreBehavior;但是,正如以前推断的那样,我担心这将徒劳无功,因为WorkflowApplication当前未记录任何内容(或什至尝试记录,据我所知).

  1. Does the ServiceHost SqlWorkflowInstanceStoreBehavior override the SqlWorkflowInstanceStore on the WorkflowApplication? If so, the obvious answer would be to remove the SqlWorkflowInstanceStoreBehavior on the ServiceHost; however, as inferred before, I fear that will prove fruitless, as the WorkflowApplication currently isn't logging anything (or even attempting to, from what I can tell).

ASAppInstanceService似乎特定于WindowsServer.如果ServiceHost(通过Windows Service选项)始终 会阻止/禁用WorkflowApplication进行SQL调用,是否可以在Windows 10上托管这些(用于开发/预生产)?/p>

ASAppInstanceService seems specific to WindowsServer. Is is possible to host those (for dev/pre-production) on Windows 10, if the ServiceHost (via Windows Service option) is always going to block/disable the WorkflowApplication from making the SQL calls?

推荐答案

找出答案:

newWorkflowApplication.Persist();

这篇关于WWF:SqlWorkflowInstanceStoreBehavior与SqlWorkflowInstanceStore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆