Focus on biztalk -- chnking

心无旁骛,专注于biztalk......

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

(2007-9-25日更新)

 

一、    定制Pipeline componentassembly的部署

定制Pipeline componentassembly不一定要放在GAC中,可以放在<biztalk install directory>\Pipeline Components目录下,但是这时定制Pipeline component所引用的其它assembly必须也放在此目录中。

如果把定制Pipeline componentassembly放到GAC中,那么定制Pipeline component所引用的其它assembly必须也放在GAC中,否则定制Pipeline component不知道去哪找到它所引用的其它assembly

当定制Pipeline componentassemblyGAC<biztalk install directory>\Pipeline Components目录下有存在,那么优先使用<biztalk install directory>\Pipeline Components目录下的assembly

二、    定制Pipeline component的调试

无论把定制Pipeline componentassembly放到GAC中还是放在<biztalk install directory>\Pipeline Components目录下,都可以对定制Pipeline componen进行源代码级别调试。

为了方便,一般把Pipeline component项目的输出路径指向<biztalk install directory>\Pipeline Components目录。

1、 调试已部署的Pipeline component

对于已经部署的biztalk项目,项目中使用到了定制的Pipeline component,可以在VS2005环境下对Pipeline component进行源代码级的调试。

l       VS2005中打开Pipeline component项目

l       Pipeline component项目输出路径指向<biztalk install directory>\Pipeline Components目录。

l       VS2005debug菜单中选“Attach to Process”,如下图。在进程中选“BTSNTSvc.exe”,这是biztalk的服务进程,然后点击Attach按钮,把进程附加到VS2005

clip_image001

Figure1. 附加进程

 

l         Pipeline component源代码中需要调试的地方设置断点。

l         在相应的输入位置提供输入消息,以便消息进入使用了定制Pipeline component的管道,在运行到设置了断点的代码处,进程暂停,即可进行断点调试。

2、 利用pipeline.exe调试未部署的Pipeline component

如果只定制了Pipeline component,并使用这个Pipeline component设计了一个管道,即有了使用这个定制Pipeline componentbtp文件,这时就可对Pipeline component进行源代码级的调试了。

这种情况需要使用pipeline.exe工具调试Pipeline component

l         VS2005中打开Pipeline component项目

l         Pipeline component项目输出路径指向<biztalk install directory>\Pipeline Components目录。

l         改变Pipeline component项目的启动动作,打开Pipeline component项目的属性页。选左边debug标签,在start action下选择“Start external program”,然后点击“…”按钮,在路径<biztalk Installation Folder>\SDK\Utilities\PipelineTools中选择 Pipeline.exe,表示使用pipeline来启动这个Pipeline component项目。在Start Options输入相应的命令行参数。参数设置:
首先指定btp文件,即在管道中使用了这个Pipeline component的管道文件。
其次指定输入文件
最后指定输出文件
一个参数看上去像这样:
C:\Samples\UnzipDisassembler\PipelineTest\UnzipTest.btp -d C:\Samples\UnzipDisassembler\test.zip -t -m C:\Samples\UnzipDisassembler\out\Part_%MessagePartID%.out

l         Pipeline component源代码中需要调试的地方设置断点。

l         把输入文件放入到参数中指定的位置。

l         F5开始运行

 

三、    定制Disassembler Pipeline component的注意事项

1、 不要在代码中关闭输入stream

输入消息的stream不仅在Pipeline component,别的组件功能可能也需要使用这个stream,比如HAT跟踪组件也要使用消息stream来跟踪消息。如果在定制Pipeline component代码中关闭了stream,将会影响到HAT对消息的跟踪。

2、 在代码中保证生成的stream的当前位置放置在stream的起点

使用类似下面的代码将stream的当前位置设置到stream的起点:

myDataStream.Seek(0, SeekOrigin.Begin);

因为如果不把stream的当前位置设置回起点,还处于stream的终点处,这个stream进入到下一个stage的组件中,组件代码直接读取stream,会读不出内容,导致意想不到的结果。

3、 在定制管道组件的任何字符串变量中都不要包含换行符

在使用biztalk 2006时,在在定制管道组件的任何字符串变量中都不要包含换行符,比如\n,否则,在编译这个组件是会得到一个“newline in constant”错误。

4、 使用命令行排除非组件代码错误

有时由于一些设置问题或者管道文件btp被手工修改又被改错了,这些问题不是定制管道本身的问题,会导致管道组件不被执行,表现现象一般是在VS2005中使用pipeline.exe进行源代码调式时,运行后始终运行不到断点就推出了,也没有任何提示。

这时可以进入命令行模式,直接运行pipeline.exe,命令后面跟上在VS2005环境中设置的pipeline.exe的调试参数,执行。如果是调试参数或者btp文件本身的设置问题,pipeline.exe命令会有出错提示,下面是两个比较常见的问题:

4.1.        pipeline.exe调试时路径参数如有空格需要引号

使用pipeline.exe调试时参数管道文件、输入、输出文件路径如有空格,比如btp文件所在的路径是这样:C:\UnzipDisassembler\PipelineTest project\UnzipTest.btp

路径中包含有空格字符,就必须把路径用引号把路径包含起来,不然pipeline.exe会找不到文件,提示以下错误:

Source:    Pipeline

Message:   Pipeline file name is already specified

4.2.        管道btp文件设置错误

如果管道文件中的配置有错误,比如Stage标签的结束标签被改成了小写的stage,就会被提示以下错误:

Source:   System.Xml

Message:   37 上的开始标记“Stage”与结束标记“stage”不匹配。

39,位置 7

posted on 2007-09-13 17:43  chnking  阅读(2645)  评论(1编辑  收藏  举报