有时候为了BizTalk的维护方便有些信息需要放到配置文件里面。BizTalk提供了在C:\Program
Files\Microsoft Biztalk Server 2004(2006)\BTSNTSvc.exe.config 进行配置的功能。但是如果项目多了也不好维护。以下的方法是通过配置BTSNTSvc.exe.config实现给单独的项目独立的配置文件的方法。
1. BTSNTSvc.exe.config 的配置
<ConfigSections>
<section name="xlangs"
type="Microsoft.XLANGs.BizTalk.CrossProcess. XmlSerializationConfigurationSectionHand
ler, Microsoft.XLANGs.BizTalk.CrossProcess" />
</configSections>
<xlangs>
<Configuration>
<AppDomains AssembliesPerDomain="10">
<AppDomainSpecs>
<AppDomainSpec Name="MyAppDomain" SecondsIdleBeforeShutdown="-1"
SecondsEmptyBeforeShutdown="12000">
<BaseSetup>
<ConfigurationFile>c:\temp\app.config</ConfigurationFile>
</BaseSetup>
</AppDomainSpec>
</AppDomainSpecs>
<ExactAssignmentRules>
<ExactAssignmentRule AssemblyName="myAssemblyName, Version=1.0.0.0
Culture=neutral PublicKeyToken=5a4c37737373" AppDomainName="MyAppDomain" />
</ExactAssignmentRules>
</AppDomains>
</Configuration>
</xlangs>
c:\temp\app.config的配置信息
<configuration>
<appSettings>
<add key="mykey" value="myvalue" />
</appSettings>
</configuration>
完成以上配置之后你可能在Orchestraction表达式或类库里通过以下的方式获取到值:
System.Configuration.ConfigurationSettings.AppSettings("mykey")
更改 BTSNTSvc.exe.config的信息之后请重启BizTalk Host以确保更改的信息能被应用。
希望这篇文件对您有帮助。
Cheers
Ben Jiang