zoukankan      html  css  js  c++  java
  • SharePoint Workflow的code运行在哪个进程? w3wp.exe 还是OWSTimer.exe?

    之前做Workflow的问题, 代码一般都会运行在OWSTimer中. 于是便天真的认为所有的workflow都运行在OWSTimer进程中.

    周二, 在客户的Win7上安装的SharePoint 2010里分析一个workflow的问题, 直接就抓了OWSTimer的TTT dump回来.

    拿到之后一看, 客户的代码里的方法根本没有被执行过.

    于是怀疑workflow是不是会在w3wp.exe里执行的. 在客户的环境上, 使用VS2010定下断点, 然后启动workflow. 注意, SPS2010里的workflow开发进程的attach是自动的.

    断点进入了, 检查VS2010所Attach的进程, 果然是w3wp.exe.

    额... 枉我自认为SharePoint基础扎实. 居然在这个问题上栽了. 汗呀~

    那么究竟是什么因素决定workflow究竟是在w3wp.exe还是OWSTimer.exe里运行呢?

    微软产品组的Paul Andrew给出答案如下:

    Workflow instances in SharePoint run in either the sptimerv3.exe process or the w3wp.exe process. Which one an instance runs in at any particular time depends on what the most recent waiting activity. If the workflow starts as a result of a user interactive operation or if it restarts after waiting for a user activity which is web oriented, then the workflow instance will be executing on the w3wp.exe process. If the workflow instance restarts as a result of a Delay activity (some timeout) then it will be running on the v3timer.exe process.

    I recommend you use the Visual Studio 2008 built in SharePoint workflow template and have Visual Studio 2008 and SharePoint 2007 on your development machine. This avoids most of the complexities with debugging workflow in SharePoint as Visual Studio 2008 will take care of it.

    Alternatively, you can use Visual Studio to attach to both processes to do your debugging and it will work just fine.

    Workflow instances running on your site lists do not run on your Central Admin process.

    翻译:

    SharePoint里的Workflow实例要么运行会运行在OWSTimer.exe里, 要么运行在w3wp.exe里. 某个特定的时间点上, 一个workflow的实例究竟运行在哪个进程里取决于最近的一次等待动作(activity). 如果workflow由于一次用户交互而启动, 或者它等待用户的某个动作之后重启的话(基本上都是web交互式的), 那么workflow实例会运行在w3wp.exe进程里. 如果workflow实例由于一个延迟动作(delay activity)(比如超时)而重启的话, 那么它会在OWSTimer.exe中运行.

    另外, 注意STSADM的Workflow-eventdelivery-throttle属性的propertyvalue的说明:

    A valid integer. For example, if the value is set to 15, 15 workflows are active in memory, and the sixteenth workflow automatically starts. The auto-start will be sent to the timer service to be processed later.

    The default value is 15.

    即, 即使是web交互式启动的workflow如果同时有超过throttle数值个同时启动的话, 那么超出的部分也会在OWSTimer里运行.

    唉, 一个小小的问题竟如此纠结. 不过, 研究到这里也算告一段落了.

    Reference

    ===================

    In which process to Sharepoint 2007 Workflows run?

    http://stackoverflow.com/questions/371657/in-which-process-to-sharepoint-2007-workflows-run

    Workflow-eventdelivery-throttle: Stsadm property (Windows SharePoint Services)

    http://technet.microsoft.com/en-us/library/cc287939%28v=office.12%29.aspx

  • 相关阅读:
    Emacs使用gnus收发邮件时nnfolder相关介绍
    emacs 播放mp3
    你真的会写二分查找吗?
    数独的经典case
    MySQL处理千万级数据查询、分页
    Mysql Replication 机制
    redis位图(bitmap)常用命令的解析
    由浅入深了解线程池之源码初探
    BlockingQueue家族成员一览
    由浅入深了解线程池之初识线程池
  • 原文地址:https://www.cnblogs.com/awpatp/p/2398351.html
Copyright © 2011-2022 走看看