Config Files in COM+ Applications
Posted: Friday, February 06, 2004 10:10 AM
by
bruce
Filed under: Not-so-SOAP
One of the reasons that I blog is to help me keep track of the nuggets of information that I come across in my travels to various clients. I long ago gave up the idea that I could remember everything that I learned and as I get older, the volume that I remember seems to be decreasing, especially as a percentage of the knowledge that would be useful to have. As a result, my reasons for posting are not always altruistic. This is one such post.
The initial problem was encountered at a client last year. The situation involved trying to create a configuration for a server-style COM+ application. For the normal application, configuration settings are stored in a file named executable.exe.config. But for server-style COM+ applications, all of then applications are run by dllhost.exe. This means that they would use (by default) the dllhost.exe.config file, the location of which is normally in the %windir%/System32 directory. There are situations, however, where this is not acceptable. So it becomes necessary to create individual config files for different COM+ applications.
The solution involves the application.manifest file. First, in the configuration screen for the COM+ application, set the Application Root Directory to a particular directory. Any directory will do, but it needs to be different for each application that requires its own config file. In the specified directory, two files need to be added. The first is a file called application.manifest. This file is intended to describe the dependencies that are required by a particular application. However, the contents of the file for this particular purpose can be quite simple. For example, the following is sufficient.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
</assembly>
The second file, again placed into the Application Root Directory, is called application.config. The contents of this file is the normal config file. With these two files in place, the COM+ application now has the freedom to access its own configuration information through the regular channels. Flexibility lives!!
If you would like to receive an email when updates are made to this post, please register here