BizTalk WCF自定义行为扩展未显示

BizTalk WCF自定义行为扩展未显示,biztalk,endpoint,behavior,biztalk-2013,Biztalk,Endpoint,Behavior,Biztalk 2013,我进行了以下行为扩展: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel.Configuration; using System.ServiceModel.Description; using System.ServiceModel.Discovery; name

我进行了以下行为扩展:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using System.ServiceModel.Discovery;

namespace Residence.WCFEndpointBehavior
{
    namespace Residence.WCFEndpointBehavior
    {
        public class MustUnderstandValidationOffElement : BehaviorExtensionElement
        {
            protected override object CreateBehavior()
            {
                return new MustUnderstandBehavior(false);
            }

            public override Type BehaviorType
            {
                get
                {
                    return typeof(MustUnderstandBehavior);
                }
            }
        }
    }
}
结果程序集名称为MustUnderstandValidationOffElement

版本是1.1.0.0

我把总成放进了GAC

GacUtil /lr MustUnderstandValidationOffElement
返回

MustUnderstandValidationOffElement,版本=1.1.0.0,区域性=neutral,PublicKeyToken=5f1263db97cf42d0,processorArchitecture=MSIL

在BizTalk 2013 R2中,我打开相关主机名的WCF自定义适配器并导入:

<configuration>
<system.serviceModel>
<extensions>
<behaviorExtensions>
  <add name="mustUnderstandValidationOffElement" type="Residence.WCFEndpointBehavior.MustUnderstandValidationOffElement, MustUnderstandValidationOffElement, Version=1.1.0.0, Culture=neutral, PublicKeyToken=5f1263db97cf42d0"/>
</behaviorExtensions>
</extensions>
</system.serviceModel>
</configuration>

在WCF自定义传输属性中

接下来,我重新启动主机的主机实例

我关闭BizTalk Server管理控制台,然后再次打开它

接下来,我使用主机中的WCF自定义适配器打开发送端口的属性->单击配置并选择绑定。 我右键单击EndpointBehavior并选择Add extension

唉-我的“mustUnderstandValidationOffElement”没有出现在列表中


非常感谢您的帮助

感谢Dijkgraaf指导我找到解决方案。创建用于签名我的端点行为的新特定强名称密钥后,它出现在添加扩展名列表中

它没有配置machine.config的


但是将此行为添加到发送端口并不会阻止向远程服务器发送mustUnderstand=1。相反,它似乎使我们的Biztalk server忽略了任何mustUnderstand=1,这与我们需要的正好相反。

多亏Dijkgraaf指导我找到了解决方案。创建用于签名我的端点行为的新特定强名称密钥后,它出现在添加扩展名列表中

它没有配置machine.config的


但是将此行为添加到发送端口并不会阻止向远程服务器发送mustUnderstand=1。相反,它似乎会使我们的Biztalk server忽略任何mustUnderstand=1,这与我们需要的正好相反。

您需要为它向machine.config文件中添加条目。将它放入machine.config文件将改变所有WCF自定义适配器上的行为。据我所知,这正是BizTalk 2013支持它的原因。谢谢Dijkgraaf!您已经看到了这一点-尽管将其添加到machine.config不应改变所有WCF自定义适配器的行为,但这是徒劳的,仅限于您在该端口的端点行为中选择它的那些适配器。代码中的异常会改变在该上下文中运行的所有内容的行为,例如,设置TLS版本
ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls12
这可以通过在一个独立的主机实例中运行该端口来缓解,而不是在您不希望受到影响的主机实例中运行该端口。您需要为该端口向machine.config文件中添加条目。将其放入machine.config文件将改变该端口的行为所有WCF自定义适配器。据我所知,这正是BizTalk 2013支持它的原因。谢谢Dijkgraaf!您已经看到了这一点-尽管将其添加到machine.config不应改变所有WCF自定义适配器的行为,但这是徒劳的,仅限于您在该端口的端点行为中选择它的那些适配器。您的代码所做的异常会改变在该上下文中运行的所有内容的行为,例如设置TLS版本
ServicePointManager.SecurityProtocol=SecurityProtocolType.Tls12
可以通过在不希望受到影响的主机实例中运行该端口来缓解此问题。