سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top