app.config access from DLL with MTS on NT4 - Interop

G

Guest

I have a DLL created by vb.net using the comclass template.
This Dll will be running in MTS on Windows NT4.

When testing the DLL from a stub EXE, the config file is located with the EXE.

Where should the app.config be located in a MTS environment?
And what is the app exe name?

Here is a code snippit:
Dim objNameValueCollection As NameValueCollection =
ConfigurationSettings.GetConfig(strHost)

strHost will be either 'EDS' or 'GPS' in this example.

Here is the config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>



<configSections>
<sectionGroup name="Gateway">
<section name="EDS" type="System.Configuration.NameValueSectionHandler" />
<section name="GPS" type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</configSections>

<Gateway>
<EDS>
<add key="IPAddress" value = "127.0.0.1" />
<add key="Port" value = "8000" />
<add key="SendTimeOutSeconds" value = "10" />
<add key="RecvTimeOutSeconds" value = "10" />
<add key="RecvBufferSize" value = "3000" />
<add key="ConnectRetrys" value = "5" />
<add key="ConnectRetrySleepMilliseconds" value = "1000" />
</EDS>
<GPS>
<add key="IPAddress" value = "127.0.0.1" />
<add key="Port" value = "8000" />
<add key="SendTimeOutSeconds" value = "10" />
<add key="RecvTimeOutSeconds" value = "10" />
<add key="RecvBufferSize" value = "3000" />
<add key="ConnectRetrys" value = "5" />
<add key="ConnectRetrySleepMilliseconds" value = "1000" />
</GPS>

</Gateway>
 
G

Guest

No matter what you are building the highest level process in that domain
controls the config file. Having said that ... in general, COM+/MTS processes
are best served from a known location rather than attempt to use the .NET
config file. There may be a way around this, but technically you are in the
COM world when you start playing around with component services. As such, you
are playing, at least in part, by COM rules.

If someone knows an exception to my understanding, please post. I would love
to learn some new tricks.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
G

Guest

The reason I am looking to use the app.config .net functionality is because
it is my understanding that .net will read the values on the first reference.
The values are then cached for future use. I wish to avoid reading the
config file or a database on every call of this DLL. This is going to be a
Sockets DLL with a somewhat high volume of activity.

Thanks for the input.
Robert Hill
 
K

Kevin Yu [MSFT]

Thanks for Gregory's quick response!

Hi Robert,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know where to put the
config file for the DLL when you're using it from an MTS on NT4. If there
is any misunderstanding, please feel free to let me know.

As far as I know, only an EXE uses config file to store data, DLL doesn't
have a config file. If you're referring to the .config file for the caller,
I think it has to be in the same directory as the EXE.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
G

Guest

When calling a .net program from a DLL within MTS, the .net app config file
will be located with the MTX.EXE program. And its name will be
MTX.EXE.CONFIG. This location on our server was WINDOWS/SYSTEM32.

Robert.
 
K

Kevin Yu [MSFT]

Hi Robert,

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top