Mar 12, 2012 at 2:46 AM
Edited Mar 12, 2012 at 2:50 AM
It's hard to say what is going on without some more information.
What do you mean by the logging doesn't work: are you getting an error or are no log entries appearing? What trace listener are you using (Flat File, Event Log, Database, etc.)?
I would guess it's probably a permission issue but it's hard to say; console mode would be running as the interactive user while the service would be running under a service account.
Enterprise Library support engineer
For this application, we use File configuration source. When the application runs as a service, enterprise library will complain that the specified configuration file can't be found. When I change the file configuration source from relative file path to
an absolute file path, the problem disappear. When the application runs as a console application, there is no problem at all. The app.config file looks like:
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
requirePermission="true" /> </configSections>
<enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
<sources> <add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common" filePath="Logging.config"
/> <add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common" /> </sources>
Enterprise library will complain the file Logging.config can't be found.
Do you know the reason? Thanks.