none
HIPService.exe.config RRS feed

  • Question

  • We have a Host Initiated Process being called from mainframe. The method we invoke is implemented in a .NET dll and takes some parameters from a config-file.

    When we build the dll we get a config-file on the standard format appname.dll.config. We've made a small Windows-applikation to test the method and it works like it should, reading parameters from windowsAppName.exe.config. But when we invoke the method through the HIS it's being controlled by HIPService.exe and then it should read parameters from HIPservice.exe.config, right? But we can't seem to make it work. Is there some special trick to make this work? Should the config-file be placed in a special directory or have a special format?

    When I placed HIPservice.exe.config in the System-directory under Host Integration Server I ended up with this error on the eventlog :

    834) A Transaction Integrator HIP Application called a user application which failed and returned the following Error Description: 
     Configuration system failed to initialize
     
    Any tips or examples of config-files would be greatly appreciated :)

    Wednesday, March 7, 2012 2:14 PM

Answers

  • Hi,

    If you call an application or assembly from another application or assembly you need to implement in you called assembly a way to load the config file. By default the only config file loaded is the config file from the main application.

    You can use linkedconfiguration :http://msdn.microsoft.com/en-us/library/ms404300.aspx

    This enables you to link the other config file (not loading).

    In that case it takes the values specified before compiling your assembly. If you will be able to load correctly the config file you need to implement on your NEW routine a way to load the config file !

    You may use this code below (vb.net) not c# :-)

    Dim rcfm as new system.configuration.execonfigurationfilemap
    
    rcfm.execonfigfilename = system.reflection.assembly.getexecutingassemby().location + ".config"
    
    dim rc as system.configuration.clientsettingssection = system.configuration.configurationmanager.openmappedexeconfiguration(rcfm, system.configuration.configurationuserlevel.none)
    
    Dim ss as system.configuration.clientsettingssection = nothing
    
    'Reads the Application Settings
    If rc.sectiongroups("applicationSettings") isnot nothing then
    ss = Ctype(rc.sectiongroups("applicationSettings").sections(system.reflection.assembly.getexecutingassembly().getname().name + ".my.mysettings"), system.configuration.clientsettingssection)
    if ss isnot nothing then
    for each key as object in ss.settings
    Dim se as configuration.settingelement = ctype(key, configuration.settingelelement)
    my.mysettings.default.item(se.name).tostring()
    my.nysettings.default.propertyvalues.item(se.name).propertyvalue = ss.settings.get(se.name).value.valuexml.innertext
    next
    end if
    end if
    Best Regards,


    Steve Melan - BCEE My Blog : http://stevemelan.wordpress.com

    Thursday, March 8, 2012 1:07 PM

All replies

  • What version of HIS are you using? Upto (and including) 2009, the HIP Service was unmanaged code, and as such might not automatically be picking up the config file (we used COM Interop to get into the "managed arena" and then call customer DLLs). I know that we had to add specific code (somewhere, at some time... :-) ) to allow for Remoting to be used by customer DLLs.

    Rob

    Wednesday, March 7, 2012 5:50 PM
    Moderator
  • We're in the process of upgrading to HIS 2010 but at the moment most of our environments are using HIS 2009.
    Wednesday, March 7, 2012 5:55 PM
  • Hi,

    If you call an application or assembly from another application or assembly you need to implement in you called assembly a way to load the config file. By default the only config file loaded is the config file from the main application.

    You can use linkedconfiguration :http://msdn.microsoft.com/en-us/library/ms404300.aspx

    This enables you to link the other config file (not loading).

    In that case it takes the values specified before compiling your assembly. If you will be able to load correctly the config file you need to implement on your NEW routine a way to load the config file !

    You may use this code below (vb.net) not c# :-)

    Dim rcfm as new system.configuration.execonfigurationfilemap
    
    rcfm.execonfigfilename = system.reflection.assembly.getexecutingassemby().location + ".config"
    
    dim rc as system.configuration.clientsettingssection = system.configuration.configurationmanager.openmappedexeconfiguration(rcfm, system.configuration.configurationuserlevel.none)
    
    Dim ss as system.configuration.clientsettingssection = nothing
    
    'Reads the Application Settings
    If rc.sectiongroups("applicationSettings") isnot nothing then
    ss = Ctype(rc.sectiongroups("applicationSettings").sections(system.reflection.assembly.getexecutingassembly().getname().name + ".my.mysettings"), system.configuration.clientsettingssection)
    if ss isnot nothing then
    for each key as object in ss.settings
    Dim se as configuration.settingelement = ctype(key, configuration.settingelelement)
    my.mysettings.default.item(se.name).tostring()
    my.nysettings.default.propertyvalues.item(se.name).propertyvalue = ss.settings.get(se.name).value.valuexml.innertext
    next
    end if
    end if
    Best Regards,


    Steve Melan - BCEE My Blog : http://stevemelan.wordpress.com

    Thursday, March 8, 2012 1:07 PM