user1312242
user1312242

Reputation: 337

Enterprise Library Class Library App.Config

I have a class library whcih is a Wrapper class for Enterprise Library Logging Application Block. There I kept an App.Config configuration file. Where all the Enterprise Library related configurations are present.

Now I refered this Class Library in a ASP.NET Web Application. Problem I am getting is: The ASP.NET Web Application is unable to read the App.Config file to fetch Configuration Information. And I am getting below Exception:

enter image description here

Upvotes: 1

Views: 730

Answers (1)

Chris Tavares
Chris Tavares

Reputation: 30411

Config files are per appdomain, not per binary. If you've got an .exe, it'll looking .config, in a web app, it looks in web.config. There are some tricks you can use, but they all involved putting something in the main config file - you can't avoid it for the most part.

The easiest thing to do would be to put the information in the web.config file. There are some other options, but they get increasingly more complicated. What version of Entlib are you using? If using 5.0, there's the programmatic configuration support (the configuration builder stuff) that makes is reasonably easy to set up entlib settings through code - you could use those in your library if the configuration is actually fixed.

Although you mention you're wrapping the logging block, but the screenshot shows the exception block. Is your main app going to be using Entlib as well, or just through your wrappers?

Upvotes: 3

Related Questions