可以通过编程方式或使用 BizTalk 管理控制台来配置 WCF-CustomIsolated 接收位置。
配置属性
BizTalk 资源管理器对象模型使你能够以编程方式创建和配置接收位置。 BizTalk 资源管理器对象模型公开IReceiveLocation 接收位置配置接口,该接口具有 TransportTypeData 读/写属性。 此属性接受一个WCF-CustomIsolated接收位置配置属性包,其形式为XML字符串的名称-值对。 若要在 BizTalk 资源管理器对象模型中设置此属性,必须设置 IReceiveLocation 接口的 InboundTransportLocation 属性。
无需设置 IReceiveLocation 接口的 TransportTypeData 属性。 如果未设置,WCF-CustomIsolated 适配器将使用 WCF-CustomIsolated 接收位置配置的默认值,如下表所示。
下表列出了可以在 bizTalk Explorer 对象模型中为 WCF-CustomIsolated 接收位置设置的配置属性。
属性名称 | 类型 | DESCRIPTION |
---|---|---|
身份 | XML Blob 示例: <身份> <userPrincipalName value=“username@contoso.com” /> </身份> |
请指定此接收位置所提供服务的身份。 可以为 Identity 属性指定的值因安全配置而异。 这些设置使客户端能够对此接收位置进行身份验证。 在客户端和服务之间的握手过程中,Windows Communication Foundation (WCF) 基础结构将确保预期服务的标识与此元素的值匹配。 默认值为空字符串。 |
BindingType | 枚举 - basicHttpBinding - customBinding - mexHttpBinding - mexHttpsBinding - mexNamedPipeBinding - mexTcpBinding - netMsmqBinding - netNamedPipeBinding - netPeerTcpBinding - netTcpBinding - wsDualHttpBinding - wsFederationHttpBinding - wsHttpBinding |
指定此接收位置使用的终结点绑定类型。
注意: 如果使用自定义绑定,则可以使用自定义绑定配置 BindingType 属性。 有关如何使用自定义绑定的详细信息,请参阅 如何使用 WCF 适配器启用 WCF 扩展点。 默认值为空字符串。 |
BindingConfiguration | XML Blob 示例: <binding name=“wsHttpBinding” transactionFlow=“true”><security><message clientCredentialType=“UserName” /></security></binding> |
使用 <绑定> 元素指定 XML 字符串,以配置 Windows Communication Foundation (WCF) 提供的不同类型的预定义绑定。 有关系统提供的绑定和自定义绑定的详细信息,请参阅“另请参阅”中的相应主题。
注意: BizTalk Server 不支持可以使用 BindingConfiguration 属性配置的绑定扩展元素的所有类型。 默认值为空字符串。 |
ServiceBehaviorConfiguration | XML Blob 示例: <behavior name=“SampleServiceBehavior”><serviceAuthorization principalPermissionMode=“UseAspNetRoles” /><serviceCredentials><serviceCertificate findValue=“539d9ab3089bb6dc187fa7dbb382cf01f8d78f5f” storeLocation=“CurrentUser” x509FindType=“FindByThumbprint” /></serviceCredentials><serviceMetadata httpGetEnabled=“true” /></behavior> |
指定 XML 字符串,其中包含 <behavior> 元素位于 <serviceBehaviors> 元素内以配置 WCF 服务的行为设置。 有关 serviceBehaviors< 元素的详细信息>,请参阅“另请参阅”中的相应主题。 默认值为空字符串。 |
EndpointBehaviorConfiguration | XML Blob 示例: <behavior name=“sampleBehavior”><callbackTimeouts /></behavior> |
指定包含<behavior>元素的 XML 字符串,在<endpointBehaviors>元素之中,以配置 WCF 终结点的行为设置。 有关 <endpointBehaviors> 元素的详细信息,请参阅“另见”中的相关主题。
注意: BizTalk Server 不支持可以使用 EndpointBehaviorConfiguration 属性配置的所有类型的行为扩展元素。 默认值为空字符串。 |
CredentialType | 枚举 - 无:当此接收位置发送请求消息来轮询外部服务时,请勿使用任何凭据,或者此接收位置不需要轮询任何外部服务。 - IssueTicket:使用企业单点登录(SSO)Sign-On 以检索客户端凭据来颁发 SSO 凭证。 此选项要求使用一种安全模式,使此接收位置能够模拟用户帐户来发放 SSO 票证。 - UserAccount:在此接收位置发送请求消息以轮询外部服务时,请使用Username和Password属性中指定的凭据。 - GetCredentials:当此接收位置发送请求消息来轮询外部服务时,请使用 AffiliateApplicationName 属性中指定的 SSO 关联应用程序。 |
指定轮询外部服务时要使用的此接收位置的凭据类型 默认值: 无 |
UserName | 字符串 | 指定轮询外部服务以检索响应消息时要使用的此接收位置的用户名。 当 CredentialType 属性设置为 UserAccount 时,此属性是必需的。 默认值为空字符串。 |
密码 | 字符串 | 指定轮询外部服务以检索响应消息时要使用的此接收位置的密码。 当 CredentialType 属性设置为 UserAccount 时,此属性是必需的。 默认值为空字符串。 |
AffiliateApplicationName | 字符串 | 指定 SSO 关联应用程序以返回在接收位置发送请求消息以轮询外部服务时要使用的外部凭据。 指定的 SSO 关联应用程序必须在此接收位置运行的 Windows 帐户与外部服务的帐户之间建立映射关系。 当 CredentialType 属性设置为 GetCredentials 时,此属性是必需的。 默认值为空字符串。 |
OrderedProcessing | 布尔型 | 指定在处理消息时是否保留消息顺序。 默认值: False |
InboundBodyLocation | 枚举 - UseBodyElement - 使用传入消息的 SOAP Body 元素的内容来创建 BizTalk 消息正文部件。 如果 Body 元素具有多个子元素,则只有第一个元素成为 BizTalk 消息正文部分。 - UseEnvelope - 从传入消息的整个 SOAP 信封 创建 BizTalk 消息正文部分。 - UseBodyPath - 使用 InboundBodyPathExpression 属性中的正文路径表达式创建 BizTalk 消息正文部件。 根据传入消息的 SOAP Body 元素的即时子元素计算正文路径表达式。 此属性仅适用于请求响应端口。 有关如何使用 InboundBodyLocation 属性的详细信息,请参阅 指定 WCF 适配器的消息正文。 |
指定传入 WCF 消息的 SOAP Body 元素的数据选择。 默认值: UseBodyElement |
InboundBodyPathExpression | 字符串 有关如何使用 InboundBodyPathExpression 属性的详细信息,请参阅 WCF 适配器属性架构和属性。 |
指定正文路径表达式以标识用于创建 BizTalk 消息正文部件的传入消息的特定部分。 此正文路径表达式根据传入消息的 SOAP 正文 节点的直接子元素计算。 如果此正文路径表达式返回多个节点,则仅为 BizTalk 消息正文部分选择第一个节点。 如果将 InboundBodyLocation 属性设置为 UseBodyPath,则需要此属性。 默认值为空字符串。 |
InboundNodeEncoding | 枚举 - Base64 - Base64 编码。 - 十六进制 - 十六进制编码。 - 字符串 - 文本编码 - UTF-8。 - XML - WCF 适配器根据 InboundBodyPathExpression 中的正文路径表达式,选择节点的外层 XML 来创建 BizTalk 消息正文。 |
指定 WCF-CustomIsolated 接收适配器用来解码节点的编码类型,该节点由 InboundBodyPathExpression 中指定的正文路径表达式标识。 如果将 InboundBodyLocation 属性设置为 UseBodyPath,则需要此属性。 默认值: XML |
OutboundBodyLocation | 枚举 - UseBodyElement - 使用 BizTalk 消息正文部件为传出响应消息创建 SOAP 正文 元素的内容。 - UseTemplate - 使用 OutboundXMLTemplate 属性中提供的模板为传出响应消息创建 SOAP Body 元素的内容。 有关如何使用 OutboundBodyLocation 属性的详细信息,请参阅 指定 WCF 适配器的消息正文。 |
指定传出 WCF 消息的 SOAP Body 元素的数据选择。 此属性仅适用于请求-响应接收位置。 默认值: UseBodyElement |
OutboundXMLTemplate | 字符串 有关如何使用 OutboundXMLTemplate 属性的详细信息,请参阅 指定 WCF 适配器的消息正文。 |
为传出响应消息的 SOAP Body 元素的内容指定 XML 格式的模板。 如果 OutboundBodyLocation 属性设置为 UseTemplate,则此属性是必需的。 此属性仅适用于请求-响应接收位置。 默认值为空字符串。 |
DisableLocationOnFailure | 布尔型 | 指定是否要禁用由于接收管道故障或路由失败而导致入站处理失败的接收位置。 默认值: False |
失败时暂停消息 | 布尔型 | 指定是否因接收管道故障或路由失败, 而挂起入站处理失败的请求消息。 默认值: True |
IncludeExceptionDetailInFaults | 布尔型 | 指定是否在返回给客户端的 SOAP 错误的详细信息中包含托管异常信息,以便进行调试。 默认值: False |
ReferencedBindings | XML Blob 示例: < BindingConfiguration vt=“8”> <wsFederationHttpBinding> <binding name=“sampleBinding”> <安全模式=“消息”> <消息 issuedKeyType=“AsymmetricKey”> <issuer address=“http://www.contoso.com/samplests" binding=“wsFederationHttpBinding” bindingConfiguration=“contosoSTSBinding”/> </消息> </安全> </绑定> </wsFederationHttpBinding> </BindingConfiguration> < ReferencedBindings vt=“8”> <绑定> <wsFederationHttpBinding> <binding name=“contosoSTSBinding”> <安全模式=“消息”> <message negotiateServiceCredential=“false”> <issuer address=“ http://northwind.com/samplests ” bindingConfiguration=“northwindBinding” binding=“wsHttpBinding”></发行> </消息> </安全> </绑定> </wsFederationHttpBinding> <wsHttpBinding> <binding name=“northwindBinding”> <安全模式=“消息”> <message clientCredentialType=“Certificate” /> </安全> </绑定> </wsHttpBinding> </绑定> </ReferencedBindings> 注意:ReferencedBinding 属性不得包含 BindingConfiguration 属性中使用的绑定配置。 |
为 wsFederationHttpBinding 和 < 指定被 >issuer 元素的 bindingConfiguration 属性引用的绑定配置,该配置指示颁发安全令牌的安全令牌服务(STS)。 有关颁发者>元素的详细信息<,请参阅 <Microsoft Learn 中的颁发者>文档。 可以通过 WCF-Custom 和 WCF-CustomIsolated 适配器的 < 属性配置绑定信息,其中包括 > 和 customBinding 的 颁发者 元素。 为此属性引用的所有绑定配置必须放在<bindings>元素的形式中。 注意: - 无法在传输属性对话框中的“ 绑定 ”选项卡上配置此属性。 可以通过 WCF-Custom 和 WCF-CustomIsolated 适配器的传输属性对话框中的 “导入/导出 ”选项卡导入和导出此属性。 - <issuer> 元素的 bindingConfiguration 属性必须引用此属性中一个有效的绑定名称。 - 如果引用链不创建循环依赖项,引用绑定配置中的颁发者>元素还可以引用此属性中的其他绑定配置。< 默认值为空字符串。 |
如何使用 BizTalk 管理控制台配置 WCF-CustomIsolated 接收位置
可以在 BizTalk 管理控制台中设置 WCF-CustomIsolated 接收位置适配器变量。 如果未在接收位置设置属性,将使用 BizTalk 管理控制台中设置的默认接收处理程序值。
注释
在完成以下过程之前,必须已添加接收端口。 有关详细信息,请参阅 如何创建接收端口。
为 WCF-CustomIsolated 接收位置配置变量
如果计划在配置 WCF-CustomIsolated 适配器时使用 WCF 扩展点(如自定义绑定元素、自定义行为元素和自定义通道组件),则必须将实现扩展点的程序集和所有依赖程序集添加到 BizTalk 处理计算机(运行时计算机)和管理计算机上的全局程序集缓存中。 此外,必须将扩展组件注册到 machine.config 文件。 有关如何将 WCF 扩展点与 WCF CustomIsolated 适配器配合使用的详细信息,请参阅 如何使用 WCF 适配器启用 WCF 扩展点。
在 BizTalk 管理控制台中,展开 BizTalk Server 管理、 BizTalk 组、 应用程序,然后展开要在其中创建接收位置的应用程序。
在 BizTalk 管理控制台的左窗格中,单击 “接收端口 ”节点。 然后在右窗格中,右键单击与现有接收位置关联的接收端口或要与新接收位置关联的接收端口,然后单击“ 属性”。
在 “接收端口属性 ”对话框中的左窗格中,选择“ 接收位置”,然后在右窗格中双击现有接收位置,或单击“ 新建”创建新的接收位置。
在“接收位置属性”对话框中,在“类型”旁边的“传输”部分中,从下拉列表中选择 WCF-CustomIsolated,然后单击“配置”。
在 “WCF-CustomIsolated 传输属性 ”对话框中的“ 常规 ”选项卡上,为 WCF-CustomIsolated 接收位置配置终结点地址和服务标识。 有关“WCF-CustomIsolated 传输属性”对话框中的“常规”选项卡的详细信息,请参阅 UI 指南和开发人员 API 命名空间参考中的“WCF-Custom 传输属性”对话框、“接收”、“常规”选项卡。
在 “WCF-CustomIsolated 传输属性 ”对话框中的“ 绑定 ”选项卡上,为 WCF 配置不同类型的预定义或自定义绑定。 有关“WCF-CustomIsolated 传输属性”对话框中的“绑定”选项卡的详细信息,请参阅 UI 指南和开发人员 API 命名空间参考中的“WCF-Custom 传输属性”对话框、“接收”、“绑定”选项卡。
在 “WCF-CustomIsolated 传输属性 ”对话框中的“ 行为 ”选项卡上,为此接收位置配置终结点和服务行为。 终结点行为是一组修改或扩展服务或客户端功能的行为扩展元素。 有关“WCF-CustomIsolated 传输属性”对话框中的“行为”选项卡的详细信息,请参阅 UI 指南和开发人员 API 命名空间参考中的“WCF-Custom 传输属性”对话框、“接收”、“行为”选项卡。
在 “WCF-CustomIsolated 传输属性 ”对话框中的 “其他 ”选项卡上,配置轮询外部服务时要使用的此接收位置的凭据,以及此接收位置在处理消息时是否保留消息顺序。 有关“WCF-CustomIsolated 传输属性”对话框中的“其他”选项卡的详细信息,请参阅 UI 指南和开发人员 API 命名空间参考中的“WCF-Custom 传输属性”对话框、“接收”、“其他”选项卡。
在 “WCF-CustomIsolated 传输属性 ”对话框中的“ 消息 ”选项卡上,指定 SOAP 正文 元素的数据选择。 有关“WCF-CustomIsolated 传输属性”对话框中的“消息”选项卡的详细信息,请参阅 UI 指南和开发人员 API 命名空间参考中的“WCF-Custom 传输属性”对话框、“接收”、“消息”选项卡。
在“WCF-CustomIsolated 传输属性”对话框中的“导入/导出”选项卡上,导入和导出“常规”选项卡上的“地址”(URI)和“终结点标识”属性、绑定信息以及此接收位置的“行为”选项卡上的终结点行为。 有关“WCF-CustomIsolated 传输属性”对话框中的“导入/导出”选项卡的详细信息,请参阅 UI 指南和开发人员 API 命名空间参考中的“WCF-Custom 传输属性”对话框、“接收”、“导入-导出”选项卡。
以编程方式配置 WCF-CustomIsolated 接收位置
可以使用以下格式设置属性:
<CustomProps>
<InboundBodyPathExpression vt="8" />
<InboundBodyLocation vt="8">UseBodyElement</InboundBodyLocation>
<BindingConfiguration vt="8"><binding name="wsHttpBinding" transactionFlow="true"><security><message clientCredentialType="UserName" /></security></binding></BindingConfiguration>
<OutboundXmlTemplate vt="8"><bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="xml"/></OutboundXmlTemplate>
<CredentialType vt="8">None</CredentialType>
<Identity vt="8" />
<ServiceBehaviorConfiguration vt="8"><behavior name="SampleServiceBehavior"><serviceAuthorization principalPermissionMode="UseAspNetRoles" /><serviceCredentials><serviceCertificate findValue="539d9ab3089bb6dc187fa7dbb382cf01f8d78f5f" storeLocation="CurrentUser" x509FindType="FindByThumbprint" /></serviceCredentials><serviceMetadata httpGetEnabled="true" /></behavior></ServiceBehaviorConfiguration>
<OrderedProcessing vt="11">0</OrderedProcessing>
<IncludeExceptionDetailInFaults vt="11">0</IncludeExceptionDetailInFaults>
<AffiliateApplicationName vt="8" />
<DisableLocationOnFailure vt="11">0</DisableLocationOnFailure>
<SuspendMessageOnFailure vt="11">0</SuspendMessageOnFailure>
<BindingType vt="8">wsHttpBinding</BindingType>
<UserName vt="8" />
<InboundNodeEncoding vt="8">Xml</InboundNodeEncoding>
<EndpointBehaviorConfiguration vt="8"><behavior name="EndpointBehavior" /></EndpointBehaviorConfiguration>
<OutboundBodyLocation vt="8">UseBodyElement</OutboundBodyLocation>
</CustomProps>
以下代码片段演示如何创建 WCF-CustomIsolated 接收位置:
谨慎
此示例或指南引用敏感信息,例如连接字符串或用户名和密码。 切勿在代码中硬编码这些值,并确保使用最安全的身份验证来保护机密数据。 有关详细信息,请参阅以下文档:
// Use BizTalk Explorer object model to create new WCF-CustomIsolated receive location
string server = System.Environment.MachineName;
string database = "BizTalkMgmtDb";
string connectionString = string.Format("Server={0};Database={1};Integrated Security=true", server, database);
string transportConfigData = @"<CustomProps>
<BindingConfiguration vt=""8""><binding name=""wsHttpBinding"" transactionFlow=""true""><security><message clientCredentialType=""UserName"" /></security></binding></BindingConfiguration>
<BindingType vt=""8"">wsHttpBinding</BindingType>
</CustomProps>";
//requires project reference to \Program Files\Microsoft BizTalk Server 2009\Developer Tools\Microsoft.BizTalk.ExplorerOM.dll
BtsCatalogExplorer explorer = new Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer();
explorer.ConnectionString = connectionString;
// Add a new BizTalk application
Application application = explorer.AddNewApplication();
application.Name = "SampleBizTalkApplication1001";
// Save
explorer.SaveChanges();
// Add a new one-way receive port
IReceivePort receivePort = application.AddNewReceivePort(false);
receivePort.Name = "SampleReceivePort";
// Add a new one-way receive location
IReceiveLocation receiveLocation = receivePort.AddNewReceiveLocation();
receiveLocation.Name = "SampleReceiveLocation";
// Find a receive handler for WCF-CustomIsolated
int i = 0;
for(i=0; i < explorer.ReceiveHandlers.Count; ++i)
{
if("WCF-CustomIsolated" == explorer.ReceiveHandlers[i].TransportType.Name)
break;
}
receiveLocation.ReceiveHandler = explorer.ReceiveHandlers[i];
receiveLocation.Address = "http://mycomputer/samplepath/sampleservice";
receiveLocation.ReceivePipeline = explorer.Pipelines["Microsoft.BizTalk.DefaultPipelines.PassThruReceive"];
receiveLocation.TransportType = explorer.ProtocolTypes["WCF-CustomIsolated"];
receiveLocation.TransportTypeData = transportConfigData;
// Save
explorer.SaveChanges();
另请参阅
使用独立 WCF 接收适配器发布 WCF 服务
管理 BizTalk 主机和主机实例
如何更改服务帐户和密码
用于 WCF 适配器的证书安装
为 WCF 适配器指定消息体
配置 WCF-CustomIsolated 适配器
如何创建关联应用程序
<
<endpointBehaviors 的行为>>
<
>
<serviceBehaviors> 的<绑定行为>