Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingException: Access to the path ... is denied

Topics: General discussion, Logging Application Block
Jun 27, 2008 at 8:57 PM
Hi,
    Our server is  a windows 2000 machine. Framework 2.0. We are using Microsoft Enterprise Library 3.1.

We are creating a web service and it is working fine in our local machine(WIndow XP) and the same is not working in our above server. We have give the internet guest account Full control to our virtual directory which is under C:\input\wwwroor\... but still we below error. Below i have given log secion of web config. Kindly let us know what we are missing. Please let me know if you need any more information.

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingException: Access to the path 'c:\inetpub\wwwroot\Rating\Log' is denied. ---> System.UnauthorizedAccessException: Access to the path 'c:\inetpub\wwwroot\Rating\Log' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, DirectorySecurity dirSecurity)
   at System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity)
   at System.IO.Directory.CreateDirectory(String path)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedTextWriterTraceListener.RootFileNameAndEnsureTargetFolderExists(String fileName)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedTextWriterTraceListener..ctor(String fileName)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedTextWriterTraceListener..ctor(String fileName, ILogFormatter formatter)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener..ctor(String fileName, String header, String footer, ILogFormatter formatter)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener..ctor(String fileName, String header, String footer, ILogFormatter formatter, Int32 rollSizeKB, String timeStampPattern, RollFileExistsBehavior rollFileExistsBehavior, RollInterval rollInterval)
   at Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingTraceListenerAssembler.Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedObjectFactory`2.Create(IBuilderContext context, TConfiguration objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.TraceListenerCustomFactory.Create(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedCustomFactory`2.Create(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.TraceListenerCustomFactory.Create(IBuilderContext context, String name, IConfigurationSource configurationSource, ...
....

Like to give our Log config file section.

<

loggingConfiguration name="Logging Application Block" tracingEnabled="false"

 

 

defaultCategory="Information" logWarningsWhenNoCategoriesMatch="true">

 

<

listeners>

 

<

add fileName="Log\\rolling.txt" rollSizeKB="0" timeStampPattern="yyyy-MM-dd"

 

 

rollFileExistsBehavior="Increment" rollInterval="Day" formatter="Event Log Rolling File Text Formatter"

 

 

header="" footer="----------------------------------------"

 

 

listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null"

 

 

traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null"

 

 

name="Events Log Rolling Flat File Trace Listener" />

 

</

listeners>

 

</

loggingConfiguration>

 

Jun 30, 2008 at 5:48 PM
Hi,

Are you using impersonation?

Fernando
Jun 30, 2008 at 6:11 PM
Is that mandatory to enable impersonation in the web.config file for the Enterprise Library to work ?
Jun 30, 2008 at 6:34 PM
Hi,

No, it's not required. In fact, enabling impersonation can cause problems with permissions because the logging request will be executed under an identity that might be different from the one you have set permissions for.

Fernando


APeter wrote:
Is that mandatory to enable impersonation in the web.config file for the Enterprise Library to work ?


Jun 30, 2008 at 6:48 PM
Ok. Thanks. So any other way to solve this problem or to debug ?
Jun 30, 2008 at 7:04 PM

I'd go for procmon to try and diagnose what caused the access-denied error.

Fernando


APeter wrote:
Ok. Thanks. So any other way to solve this problem or to debug ?


Jun 30, 2008 at 9:54 PM
The tool is great. Give lot of information. It is clearly a permission denied problem. So i was mainly looking for the useraccount under which the operations are running. So i checked and gave the necessary permissions, but still having same permission denied problem.