问题
Sometimes we use global variables in our Biztalk configuration (BTSNTSvc.exe.config
), we add these with the following code:
<appSettings>
<!--<add key="ZNA_Integratie_Prestaties_OasisProxy_OasisServiceProxy_Service"
value="http://localhost/service.asmx" />-->
<add key="IPSdatum" value="20090101" />
</appSettings>
Using the following c# code we can read in the value:
ConfigurationManager.AppSettings["IPSdatum"]
Now normally we when we add a webreference to our biztalk projects we use them through ports, however a colleague of mine used an in code webreference and so added one to a c# class project, so this means there's an app.config
where the address is being held. However when we deploy our project there isn't an app.config
of course. Only the BTSNTSvc.exe.config
. I heard there is a way to add a key value to this config which can refer to the app.config
value.
Can anyone help me out here?
回答1:
Option 1:
BTSNTSvc.exe.config
file is a .NET config file, you can put the content what you see inside your app.config file inside the BTSNTSvc.exe.config
file at the correct sections.
Option 2:
You can refer to additional config files from BTSNTSvc.exe.config
file using the app domain concept as explained here
If you are dealing with only few entries, then option 1 is preferable.
Even better, try not to use inline web references within your helper classes, try to avoid the situation.
来源:https://stackoverflow.com/questions/2324868/accessing-webreference-appsettings-from-biztalk-btsntsvc-exe-config