1

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

user1312242
  • 339
  • 1
  • 3
  • 16

1 Answers1

3

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?

Chris Tavares
  • 29,165
  • 4
  • 46
  • 63
  • ohh I see!! Thanks a lot for your answer... 1) The wrapper contains logging and execption block both. 2) I am using Ent Lib 5.1 3) I want to make a class library and distribute it to Webservice team and Web Server Team (UI). So I do not want to provide web.config configuration along with the dll. Again I dont want to write configuration programatically... Is there any other work around? I see when I refer this DLL in the web application then in the bin I can see the App.config file but the web application is unable to read this file... It is reading the web.config file instead :-( – user1312242 Jun 19 '12 at 08:35