补充.config - 它是如何做的正确? [英] Supplemental .config - how is it done right?

查看:72
本文介绍了补充.config - 它是如何做的正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个补充的.config文件对我们来说似乎很合适。

This supplemental .config file seems to be a good match for us.

参考:

https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms439965(v%3doffice。 14)

https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms439965(v%3doffice.14)

我试图使用它,但对于我的生活,我再也无法让它自行清理。

I have tried to use it, but for the life of me I can't get it to clean up after itself again.

我要添加的是在sep 2018补丁之后修复工作流问题的条目 - KB4457044。

What I want to add is the entries to fix workflow issues after the sep 2018 patch - KB4457044.

web.config更改适用于服务器场中所有服务器上的所有Web应用程序。

The web.config change applies to all web application on all servers in farm.

我将它添加到visual studio中的webconfig.xxx.xml文件中:

I added this to my webconfig.xxx.xml file in visual studio:

<?xml version = QUOT; 1.0"编码= QUOT; UTF-8英寸?>
$
< actions>

  &NBSP; < add path =" configuration / System.Workflow.ComponentModel.WorkflowCompiler / authorizedTypes" ID = QUOT; {19488485-e719-4268-9c75-61fd5ea4aac2}" >

  &NBSP; &NBSP; < authorizedType Assembly =" System,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089"名称空间= QUOT; System.CodeDom"类型名= QUOT; CodeBinaryOperatorExpression"授权= QUOT;真" />

  &NBSP; < / add>

< / actions>

<?xml version="1.0" encoding="utf-8" ?>
<actions>
    <add path="configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes" ID="{19488485-e719-4268-9c75-61fd5ea4aac2}" >
      <authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeBinaryOperatorExpression" Authorized="True" />
    </add>
</actions>

我无法找到关于何时或如何处理此合并的良好资源。

I can't find a good resource as to when or how this merging is handled.

我不想在每台服务器上运行stsadm -o copyappbincontent。我想让它自己包含在一个wsp中。

I don't want to run the stsadm -o copyappbincontent on each server. I want it to be self contained in a wsp.

它似乎并没有合并。如果我把它放在我的农场范围事件接收器中它确实添加了内容:

It doesn't seem to merge on itself. It does add the enties just fine if I put this in my farm scoped event receiver:

SPFarm场= SPFarm.Local;
SPWebService service = farm.Services.GetValue< SPWebService>("");
foreach(SPWebApplication webApp in service.WebApplications)
{
if(webApp.GetType()== typeof(Microsoft.SharePoint.Administration.SPWebApplication))
{
webApp.WebService.ApplyApplicationContentToLocalServer();
休息; //如果它在每个Web应用程序上运行,我会得到重复的条目。这可能是因为我首先没有添加ID
}
}

SPFarm farm = SPFarm.Local; SPWebService service = farm.Services.GetValue<SPWebService>(""); foreach (SPWebApplication webApp in service.WebApplications) { if (webApp.GetType() == typeof(Microsoft.SharePoint.Administration.SPWebApplication)) { webApp.WebService.ApplyApplicationContentToLocalServer(); break; //If it runs on each web application I got duplicate entries. This might be due to me not having an ID on the add at first } }

我尝试在功能卸载中简单地输入相同的代码。 

I tried simply putting the same code in the feature uninstalling. 

我也尝试过只激活功能的事件,然后希望它在功能停用或wsp删除时自行清理。

I also tried just having only the feature activated event, and then hope it would clean itself upon feature deactivation or wsp removal.

除非我专门运行ApplyApplication ...方法,否则似乎没有删除这些内容或添加它们。

Nothing seems to be removing these enties or adding them unless I specifically run the ApplyApplication... method.

我不想使用spwebconfigmodification。我不是这种向web.config添加enties的特定方法。

I don't want to use the spwebconfigmodification. I wan't this specific method of adding enties to web.config.

到目前为止,我可以添加(可能不是正确的方法),但无法将其删除。

So far I can add (maybe not the correct way), but cannot get it to be removed.

我环境中唯一的其他非ms补充.config文件是nintex文件。我查看了功能事件,它似乎根本没有做任何事情,所以我还尝试了一个只有补充文件的wsp,希望内部机制在iisreset上花费
,但没有任何反应。

The only other non-ms supplemental .config file in my environments is a nintex one. I looked through the feature events and it didnt seem to do anything at all, so I tried also a wsp with just the supplemental file, hoping that an internal mechanism takes over at iisreset for instance, but nothing happened.

有任何提示的人吗?

推荐答案

如果你想创建一个wsp解决方案并使用一个功能实现它,我们需要使用SPWebConfigModification来实现它。

If you want to create a wsp solution and achieve it using a feature, we need use SPWebConfigModification to achieve it.

以下文章包含你的代码参考。

The following article with code for your reference.

https://www.codeproject.com / Articles / 390545 / SharePoint-web-config-modifications

如果您不想使用spwebconfigmodification,我们需要在每台服务器上运行stsadm -o copyappbincontent。

If you don't want to use the spwebconfigmodification, we need run the stsadm -o copyappbincontent on each server.

以下两个线程对您的参考要求类似。

Here are two threads with the similar requirement for your reference.

https://stackoverflow.com/questions/3450246/sharepoint-2010-creating-a-supplemental-web-config-file

https ://sharepoint.stackexchange.com/questions/23736/use-a-supplemental-config-file-just-for-a-web-application

最诚挚的问候,

Dennis


这篇关于补充.config - 它是如何做的正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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