Groups | Blog | Home
all groups > dotnet framework > december 2006 >

dotnet framework : Configuration problem


Rastko Soskic
12/25/2006 3:24:33 PM
I have trouble reading configuration files (configuration for class library
(dll) project).
Although I've added configuration file and properly added configuration
file,
when I try to obtain settings via configuration manager.... simply I can't.
For example ConfigurationManager.ConnectionStrings["SomeName"] is always
null, although there is properly added connectionstring with "SomeName"
name.

What could be problem? configuration files are not available for dll
project???
Any help is appreciated. Thanks in advance :)

Rastko Soskic
12/25/2006 4:00:49 PM
I've figured out what is problem. But how to solve it?

I have config file for DLL and web.config for website (DLL is middle tier
for site).

In class in DLL there is line:
ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString

"ConnString" is name within dll's config file (assemblyname.dll.config
right?) but

it looks like dll is reading web.config instead of dll.config? I understand
that is because .NET framework

searches for first config file in folder tree and web.config is first... How
to tell him to read dll's config file?
Maybe you have better idea? Thanks again :)

P.S. Maybe I should include Settins instead of config file? Is that good
solution/option?

[quoted text, click to view]

Jeff Dillon
12/25/2006 6:01:05 PM
File/New ...Configuration file
[quoted text, click to view]

AddThis Social Bookmark Button