Try using AppDomain.CurrentDomain.BaseDirectory. If that doesn't work
you can always specify "ups" in a relative path. For example, if you
discover your execution context is "...../WebService/MyApp/MyPage"
(online or running on your local directories) and the config file you
want is in ".../WebService" then the relative path would be
"..\\..\\web.config" The "..\" signifies one level up.
 

John VanderKolk 

 

________________________________

From: Parrish, Ken [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 05, 2007 3:56 PM
To: [email protected]
Subject: ConfigureAndWatch for a web app ...



I am attempting to use the method XmlConfigurator.ConfigureAndWatch for
a web service application.  In the Application_Start method in
Global.asax, I have change from:

 

XmlConfiguration.Configure();

 

To:

 

XmlConfigurator.ConfigureAndWatch("web.config");

 

However, log4net appears not to configure properly.  I suspect that
log4net cannot find 'web.config' since the current directory for the
executing application context is not the root directory of my web site.

 

How can I indicate to log4net where 'web.config' is located without
having to specify an absolute path?  Is there a way in Global.asax to
'fetch' the root directory of my web application so that I can supply it
to the ConfigureAndWatch method?

 

Thank you,

 

Ken Parrish

Bedford, MA


The contents of this e-mail are intended for the named addressee only. It 
contains information that may be confidential. Unless you are the named 
addressee or an authorized designee, you may not copy or use it, or disclose it 
to anyone else. If you received it in error please notify us immediately and 
then destroy it. 

The contents of this e-mail are intended for the named addressee only. It 
contains information that may be confidential. Unless you are the named 
addressee or an authorized designee, you may not copy or use it, or disclose it 
to anyone else. If you received it in error please notify us immediately and 
then destroy it. 

Reply via email to