在IIS中托管自托管WF [英] Hosting a self-hosted WF in IIS

查看:118
本文介绍了在IIS中托管自托管WF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是否可以在IIS中托管自托管的WorkflowServiceHost应用程序而不将其转换为XAMLX文件吗?如果可以,怎么办?

Does anyone know if it's possible to host a self-hosted WorkflowServiceHost application in IIS without turning it into a XAMLX file? If so, how?

此外,对于将XAMLX文件总体上部署到IIS 7的人,是否有人有任何好的指导原则?

Furthermore, does anyone have any good guidelines for deploying XAMLX files in general to IIS 7?

预先感谢

推荐答案

您可以通过编写自己的托管引擎而不是XAMLX来完成相同的基本操作.然后,您可以通过ASP.NET加载应用程序,但可以对其生命周期/生命周期进行完全控制.

You can do the same basic thing by writing your own hosting engine instead of the XAMLX one. You can then load applications via ASP.NET, but have complete control on it's lifespan/lifecycle.

您必须创建自己的主机,才能将.XAML工作流程加载到WorkflowApplication之类的文件中并管理该工作流程的寿命.看起来像这样:

You have to create your own host to load the .XAML workflows into something like a WorkflowApplication and manage the lifespan of that workflow. It looks something like this:

private SqlWorkflowInstanceStore _InstanceStore { get; private set; }
private InstanceHandle _MyInstanceHandle { get; private set; }

_InstanceStore = new SqlWorkflowInstanceStore(DataStore.ConnectionString.Replace("MultipleActiveResultSets=True", "MultipleActiveResultSets=False"));
_InstanceStore.HostLockRenewalPeriod = new TimeSpan(0, 0, 30);
_InstanceStore.InstanceEncodingOption = InstanceEncodingOption.None;
_InstanceStore.InstanceLockedExceptionAction = InstanceLockedExceptionAction.BasicRetry;
_InstanceStore.InstanceCompletionAction = InstanceCompletionAction.DeleteNothing;

_MyInstanceHandle = _InstanceStore.CreateInstanceHandle();
var CreateOwnerCommand = new CreateWorkflowOwnerCommand();
var MyView = _InstanceStore.Execute(_MyInstanceHandle, CreateOwnerCommand, TimeSpan.FromSeconds(30));
_InstanceStore.DefaultInstanceOwner = MyView.InstanceOwner;

WorkflowApplication ThisApplication = null;

if (parameters == null)
    ThisApplication = new WorkflowApplication(activity);
else
    ThisApplication = new WorkflowApplication(activity, parameters);
ThisApplication.PersistableIdle = e => PersistableIdleAction.Unload;
ThisApplication.InstanceStore = this.InstanceStore;
ThisApplication.Run();

除上述内容外,还有很多其他内容,但它提供了工作原理的基本概念.

There is a bit more to it then just the above, but it gives the basic concepts of how it would work.

编辑(3/23/2011)

如果有人想要复制基本代码来执行此操作,请找到一种与我联系的方法.

If anyone wants a copy of the basic code to do this, find a way to contact me.

这篇关于在IIS中托管自托管WF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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