1

我正在尝试实现此处显示的我自己的自定义行为版本:在 WCF 自定义适配器中使用 Windows 凭据 和此处:调用 WCF 服务时模拟 WCF 凭据

BizTalk 要求将所有内容都放入 GAC,我通过运行 GacUtil 做到了这一点。

我尝试对 machine.config 进行以下更改,但我知道它们不起作用,因为如果我重新启动 BizTalk 主机实例,我会收到奇怪的错误。

从此改变:

  <section name="extensions" type="System.ServiceModel.Configuration.ExtensionsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

对此:

  <section name="extensions" type="System.ServiceModel.Configuration.ExtensionsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <add name="WindowsCredentialsBehaviour" type="MyApp.Biztalk.WCF.Extensions.ImpersonateBasicCredentialsBehaviour, MyApp.CustomEndpointBehavior, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b12735283a466be4" />
  </section>

在 BizTalk 中,程序集如下所示:

MyApp.CustomEndpointBehavior,版本=1.0.0.0,文化=中性,PublicKeyToken=b12735283a466be4"

所以我有两个主要问题:

  1. 我不确定为什么在配置文件中有两个名称,一个是类或行为名称,第二个是程序集名称?
  2. 我做错什么了?

这是我的命名空间:

namespace MyApp.Biztalk.WCF.Extensions
{
    public class ImpersonateBasicCredentialsBehaviour : IEndpointBehavior
...
namespace MyApp.Biztalk.WCF.Extensions
{
    public class ImpersonateBasicCredentialsBehaviourElement : BehaviorExtensionElement
...

我还尝试使用 SDK 工具编辑 machine.config:SvcConfigEditor.exe,但它给出了这个错误,所以我只能在 NotePad++ 中进行编辑。

在此处输入图像描述

4

1 回答 1

1

您不需要定义您的部分(它已经定义)。相反,您只需在机器级别配置中配置您的扩展:

<system.serviceModel>
    <extensions>
        <behaviorExtensions>
            <add name="WindowsCredentialsBehaviour" type="MyApp.Biztalk.WCF.Extensions.ImpersonateBasicCredentialsBehaviour, Asurion.CustomEndpointBehavior" />
        </behaviorExtensions>
    </extensions>
</system.serviceModel>

然后它将与任何使用 WCF ( system.serviceModel) 的应用程序的配置文件合并。您只需要确保该类型MyApp.Biztalk.WCF.Extensions.ImpersonateBasicCredentialsBehaviour在程序集中可用于想要使用 WCF 的应用程序(在 GAC 中或在私有 bin 路径中)。

于 2015-07-14T20:40:37.480 回答