将SharePoint 2010的workflow custom activity升级到SharePoint 2013遇到的问题

详细介绍了如何在升级自定义WorkflowActivity从SharePoint2010到SharePoint2013后,解决由于配置文件变化导致的无法运行问题。通过修改web.config文件中的authorizedTypes结构,特别是添加了针对targetFx的子节点,成功解决了错误提示,并确保了活动在SharePoint2013环境下的正常运行。

        前几天需要升级一个自定义的workflow activity,从支持SharePoint 2010的版本,升级到支持SharePoint 2013。 Branch代码出来之后,在VS工程中直接升级,之后编译,部署一切都很顺利,但是在测试的时候出现问题了。

        问题是这样的:打开SharePoint Designer 2013,新建一个workflow,在workflow里使用自定义的activity,定义好了之后,保存,然后发布的时候,Designer报了一个错误:

“Errors were found when compiling the workflow. The workflow files were saved but cannot be run.” 具体的信息是“The type or namespace name xxx could not be found (are you missing a using directive or an assembly reference?)”。

        我查了一下才知道(请参见点击打开链接),web.config文件中的<authorizedTypes>结构变了,在SharePoint 2013中加了一个子节点<targetFx>,因此需要将自定义的activity的authorizedType加到这个子节点中才行。

        以下是2010中的配置文件和2013中的配置文件的对比:

        SharePoint 2010:

<System.Workflow.ComponentModel.WorkflowCompiler>
  <authorizedTypes>
      <authorizedType Assembly="Microsoft.Office.Workflow.Actions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"Namespace="Microsoft.Office.Workflow.Actions"TypeName="*"Authorized="True" />
      <authorizedType Assembly="MyActions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1234567"Namespace="MyActions"TypeName="*"Authorized="True" />
  </authorizedTypes>
  <authorizedRuleTypes>
      <authorizedType Assembly="Microsoft.SharePoint.WorkflowActions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"Namespace="Microsoft.SharePoint.WorkflowActions"TypeName="WorkflowCodeTypeReferenceExpression"Authorized="True" />
  </authorizedRuleTypes>
</System.Workflow.ComponentModel.WorkflowCompiler> 
        SharePoint 2013:
<System.Workflow.ComponentModel.WorkflowCompiler>
  <authorizedTypes>
    <targetFx version="v4.0">
      <authorizedType Assembly="Microsoft.Office.Workflow.Actions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"Namespace="Microsoft.Office.Workflow.Actions"TypeName="*"Authorized="True" />
      <authorizedType Assembly="MyActions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1234567"Namespace="MyActions"TypeName="*"Authorized="True" />
    </targetFx>
  </authorizedTypes>
  <authorizedRuleTypes>
    <targetFx version="v4.0">
      <authorizedType Assembly="Microsoft.SharePoint.WorkflowActions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"Namespace="Microsoft.SharePoint.WorkflowActions"TypeName="WorkflowCodeTypeReferenceExpression"Authorized="True" />
    </targetFx>
  </authorizedRuleTypes>
</System.Workflow.ComponentModel.WorkflowCompiler>

以下是正确的修改配置文件的代码:

var service = SPWebService.ContentService;
var addModification = new SPWebConfigModification();
addModification.Path = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes/targetFx";
addModification.Name= "authorizedType[@Assembly='MyActions'][@Namespace='MyActions'][@TypeName='*'][@Authorized='True']";
addModification.Owner= "MyActions";
addModification.Sequence= 0;
addModification.Type= SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
addModification.Value= @"<authorizedType Assembly=""MyActions""Namespace=""MyActions"" TypeName=""*""Authorized=""True"" />";
 service.WebConfigModifications.Add(addModification);
service.Update();
service.ApplyWebConfigModifications();




       

        

内容概要:本文围绕视觉大模型在医学影像辅助诊断中的应用展开探讨,旨在解决传统医学影像诊断中存在的误诊率高、读片效率低、医生工作负荷重等问题。文章系统阐述了视觉大模型在处理速度、识别精度和医疗资源均衡方面的显著优势,并提出“七横四纵”的技术架构体系,涵盖感知层、网络层、基础层、框架层、模型层、应用层、交互层以及标准规范、安全保障、运行管理、法规政策四大支撑体系。在此基础上,提出了包括健全工作机制、更新终端设备、整合影像数据、统筹系统建设、加强培训推广在内的五大建设路径,推动视觉大模型在医疗影像领域的深度融合与产业化落地。; 适合人群:从事医疗信息化、人工智能技术研发的研究人员,医疗机构管理者,医学影像专业从业人员,以及关注AI+医疗融合发展的政策制定者和技术开发者。; 使用场景及目标:①构建智能化医学影像诊断系统,提升诊断的时效性与准确性;②实现跨机构影像数据共享与结果互认,推动优质医疗资源下沉基层;③支持远程诊断、智能报告生成、早期筛查预警、个性化治疗推荐等临床应用场景;④为智慧医院和医联体建设提供技术支撑。; 阅读建议:此资源兼具技术架构设计与实践路径规划,适合结合实际医疗场景深入研读,建议重点关注模型训练、数据治理、系统集成与伦理合规等方面的实施方案,并在科研或项目实践中加以验证与优化。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值