事务集成器(TI)提供对 Windows 发起的处理(WIP)调用和主机发起的处理(HIP)调用的详细跟踪。 此跟踪是通过在应用配置文件中启用跟踪,以及使用描述应跟踪内容的主机集成跟踪定义文件(.hitd)来实现的。 可以通过 hitd 文件来打开和关闭跟踪。 还可以通过应用配置文件打开和关闭跟踪,但是,必须重新启动 TI 进程,使新配置生效,因为仅当 TI 进程启动时,才会读取应用配置文件。
以下说明演示如何设置跟踪以将跟踪文件存放在 C:\Tracing 文件夹中。 如有必要,可以使用其他文件夹 - 运行 TI 进程的帐户对跟踪文件夹具有读/写访问权限非常重要。
创建跟踪文件夹 C:\Tracing
创建主机集成跟踪定义文件(HITD)
启动跟踪查看器(必须安装 HIS):Start - Run - histraceviewer
从“文件”菜单中选择“新建定义文件”。
选择事务集成器 WIP:
跟踪大小和选择:可以为每个组件设置跟踪级别。 如果跟踪级别设置为更高的组件,则该跟踪级别也适用于从属组件。
- 右键单击“跟踪级别”,然后选择“新建级别”。
- 选择一个或多个级别,然后单击“确定”。
- 选择所有选项将导致单击“确定”后显示为“全部”。
- 将新的 HITD 文件另存为 C:\Tracing 目录中TI_Trace。 关闭跟踪查看器。
- 右键单击“跟踪级别”,然后选择“新建级别”。
使用跟踪配置信息更新应用程序配置文件。
对于 Windows 启动处理(WIP),可以将 TI .Net 项目中的 app.config 使用跟踪配置信息进行修改,并在应用程序编译时包含在 <appname> 的.exe.config 文件中。 如果应用程序已编译, <可以使用此信息直接修改 appname>.exe.config 文件。
如果在 BizTalk 中使用了适用于主机应用程序的 BizTalk 适配器(BAHA),则必须修改的配置文件是 BizTalk Server exe 配置文件,该配置文件是为 BizTalk 应用程序中的 BAHA 端口选择的 BizTalk 主机的配置文件。 配置文件位于 %BTSINSTALLPATH%,其名称为 BTSNTSvc.exe.config 或 BTSNTSvc64.exe.config,具体取决于 BAHA 端口正在使用的 32 位还是 64 位主机进程。
如果使用主机发起的处理(HIP),则必须修改的是 HIPService.exe.config 文件。 此文件位于 %SNAROOT%。
在 configSections 元素中添加以下 section 语句。 添加 configSections 元素(如果不存在)
<configSections>语句必须紧接在<configuration>之后,并且在<startup>节之前。
对于 HIS 2016 ,请在 configSections 元素中输入以下行:
<configSections> <section name="hostIntegration.tracing" type="Microsoft.HostIntegration.ConfigurationSectionHandlers.Tracing.TracingConfigurationSectionHandler, Microsoft.HostIntegration.ConfigurationSectionHandlers, Version=10.0.1000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </configSections>
对于 HIS 2013 ,请在 configSections 元素中输入以下行(不同之处在于版本更改):
<configSections> <section name="hostIntegration.tracing" type="Microsoft.HostIntegration.ConfigurationSectionHandlers.Tracing.TracingConfigurationSectionHandler, Microsoft.HostIntegration.ConfigurationSectionHandlers, Version=9.0.1000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </configSections>
在配置节的末尾部分、即 </configuration> 节结束语句之前,添加以下基本跟踪配置元素:
<hostIntegration.tracing xmlns="http://schemas.microsoft.com/HIS/Tracing/2020"> <traceOptions traceDefinitionFile="C:\Tracing\TI_Trace.hitd" writeTraceFile="true" fileNamePreamble="TI_Tracing" traceFileFolder="C:\Tracing\" /> </hostIntegration.tracing>
执行应用程序以开始跟踪。 如果对应用程序配置文件进行了更改,则必须重启 TI 运行时所使用的进程才能启用跟踪。 如果使用 BizTalk,则必须重启主机实例。 如果使用 IIS,则必须重启网站。 如果执行 .Net exe,则必须重新启动该程序。
在 C:\Tracing 文件夹中查看一个或多个 HITF(主机集成跟踪文件)文件。 文件的名称将是TI_Tracing_<进程ID号>_<日期和时间>.hitf。 例如:
TI_TRACING_6076_AUG_29_2017_13_00_52_421.HITF
双击 HITF 文件,在跟踪查看器中将其打开,并检查跟踪的内容。 如果 TI 进程仍在运行,某些跟踪信息可能仍在缓冲区中,退出应用程序或在应用程序中运行另一个 TI 调用将刷新缓冲区,以查看第一次 TI 调用的完整跟踪。
TBGen invoke entered for Class: BankingCicsElmLink.Accounts Non-Persistent Attempting to acquire library reader and load HIS object assembly Method: GetBalance Using configured RE for this object Remote Environment: ELM Link RE Aggregate Converter: Microsoft.HostIntegration.TI.AggregateConverter, Microsoft.HostIntegration.TI.AggregateConverter, Version=10.0.1000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Primitive Converter: Microsoft.HostIntegration.Common.BasePrimitiveConverter, Microsoft.HostIntegration.Common.BasePrimitiveConverter, Version=10.0.1000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Transport: Microsoft.HostIntegration.TI.ELMTransport, Microsoft.HostIntegration.TI.ELMTransport, Version=10.0.1000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 State Machine: Microsoft.HostIntegration.TI.GenericLinkStateMachine, Microsoft.HostIntegration.TI.GenericLinkStateMachine, Version=10.0.1000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 Invoking the state machine Generic Link state machine entered for method: GetBalance ELM Transport Initialized, Link: True, Codepage: 37 Header length: 35 Header Length: 35, Trailer Length: 0 Non-Persistent
关闭跟踪功能
- 在跟踪查看器中打开 TI_Trace.hitd 文件,并删除跟踪级别。 保存 hitd 文件时,将动态地关闭跟踪功能。 无需重启 TI 应用程序。
适用于各种方案的示例应用程序配置文件
- .Net WIP 应用程序程序的示例
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hostIntegration.ti.wip" type="Microsoft.HostIntegration.ConfigurationSectionHandlers.Ti.Wip.WipConfigurationSectionHandler, Microsoft.HostIntegration.ConfigurationSectionHandlers, Version=10.0.1000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<section name="hostIntegration.tracing" type="Microsoft.HostIntegration.ConfigurationSectionHandlers.Tracing.TracingConfigurationSectionHandler, Microsoft.HostIntegration.ConfigurationSectionHandlers, Version=10.0.1000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<hostIntegration.ti.wip xmlns="http://schemas.microsoft.com/his/Config/TiWip/2020">
<readOrder appConfig="first" cache="unused" registry="unused"/>
<remoteEnvironments>
<remoteEnvironment isDefault="true" name="ELM Link RE" timeout="5" codePage="37">
<elmLink ipAddress="localhost" ports="7511" requestHeaderFormat="Microsoft"/>
</remoteEnvironment>
</remoteEnvironments>
</hostIntegration.ti.wip>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
<hostIntegration.tracing xmlns="http://schemas.microsoft.com/his/Tracing/2020">
<traceOptions traceDefinitionFile="C:\Tracing\TI_Trace.hitd"
writeTraceFile="true"
fileNamePreamble="TI_Tracing"
traceFileFolder="C:\Tracing\" />
</hostIntegration.tracing>
</configuration>
- 使用适用于主机应用程序的 BizTalk 适配器的 BizTalk 应用程序的示例 - %BTSINSTALLPATH%\BTSNTSvc.exe.config or %BTSINSTALLPATH%\BTSNTSvc64.exe.config 文件:
Here is my text
- 使用 TI 运行时的 IIS 应用程序的示例
Here is my text
- TI 主机启动处理 (HIP) 应用程序的示例 - %SNAROOT%\HIPService.exe.config 文件:
Here is my text
另请参阅
SNA 跟踪实用工具 - 如果 TI 对象通过主机集成服务器网关使用 APPC,SNA 跟踪实用工具会有所帮助。 此实用工具将捕获传入和传出主机的 APPC 流量。 如果 TI 对象通过 TCP/IP 与主机系统直接通信,则此实用工具将无济于事。