Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read configuration file in COM+ server

Tags:

c#

.net

com+

I have a COM+ server (project output dll) which is consumed from a proxy (I guess this is called client applcation and runs under dllhost.exe). The COM+ server runs through a server console application (project output exe) which itself runs as a service.

I need to read a configuration file in COM+ server (dll). I do not know

  1. where should I have the config file and under what name? One config file exists for proxy with name dllhost.exe.config.
  2. how to read this config file in COM+ server?
  3. how to have my custom configration in file?

I have found this link here, but I cannot figure out what to do. Thanks

like image 781
peacefulmember Avatar asked Dec 31 '25 03:12

peacefulmember


1 Answers

1) In the COM+ application root directory you must place two files:

  • application.manifest
  • application.config

2) Your application.manifest file can have just this content:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
</assembly>

3) Your application.config file must be similar to this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="myPropertyName" value="myPropertyValue"></add>
  </appSettings>
</configuration>

4) In the COM+ sorce code, you can use

System.Configuration.ConfigurationSettings.AppSettings["myPropertyName"]

in order to read a configuration property (if you are using C#).

NOTE: the "application root directory" can be determined by using the COM+ administration console (dcomcnfg.exe), "Activation" tab.

like image 147
Manuel Quijada Avatar answered Jan 02 '26 16:01

Manuel Quijada



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!