Setting traces in NCO – Note 1610818
I ran into some annoying problems when setting traces for NCO according to Note 1610818 – Trace in .NET Connector 3.0
The first problem is “what is an application configuration file“? This is basically a configuration file you can put in the same directory as the executable. If you have program.exe you can create program.exe.config in the same directory and it will be read at runtime (I’m no expert so maybe someone will provide some more information).
The next problem is where to put the <configSections> entry in the file. It’s quite possible that you are already using a config file for your application. In that case you’d just put <configSections> and the <SAP.Middleware.Connector> sections at the end of the file right? WRONG! According to Microsoft you need to put <configSections> at the beginning of the file. Or in Microsoft’s words:
In our case we put the <configSections> and <SAP.Middleware.Connector> entries from note 1610818 at the end of the config file. When we run the program we were surprised that no traces were generated. Not only that, we got the following error in the dev_nco_rfc.log log file.
Could not initialize configuration:
System.ArgumentException: Parameter ‘sectionGroupName’ is not valid
at System.Configuration.MgmtConfigurationRecord.GetSectionGroup(String configKey)
at SAP.Middleware.Connector.RfcDestinationManager.RegisterDestinationConfiguration(IDestinationConfiguration config)
at SAP.Middleware.Connector.Examples.naoi_test.Main(String args)
sectionGroupName comes from the following part of note 1610818
<section name=”GeneralSettings” type=”SAP.Middleware.Connector.RfcGeneralConfiguration, sapnco”/>
It looks like the space between “sectionGroup” and “name” is not correctly recognized.
Everything was fixed simply by shifting the configSections entry to the start of the file as suggested by Microsoft.
I spent a couple of hours on this problem so I hope this short blog will be of help to others like me who have little experience with .NET programming but who need to take NCO traces.