Ok I am having a very odd issue when deploying one of our web applications to our live servers.
Our application uses log4net to log a lot of actions quite heavily and after a couple of hours after being deployed we get the following exception.
Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. Access is denied.
Here are the relevant web.config additions I use.
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<appender name="ErrorLogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="D:\SomeLocation\Errorlog"/>
<param name="AppendToFile" value="true"/>
<param name="RollingStyle" value="Size"/>
<param name="maxSizeRollBackups" value="-1" />
<param name="maximumFileSize" value="100MB" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="FATAL" />
<param name="LevelMax" value="FATAL" />
</filter>
</appender>
<appender name="BookingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="D:\SomeLocation\BookingInfoLog"/>
<param name="AppendToFile" value="true"/>
<param name="RollingStyle" value="Size"/>
<param name="maxSizeRollBackups" value="-1" />
<param name="maximumFileSize" value="100MB" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="FATAL" />
</filter>
</appender>
<root>
<level value="ALL"/>
<appender-ref ref="BookingLogFileAppender"/>
<appender-ref ref="ErrorLogFileAppender"/>
</root>
</log4net>
It is working fine on our local machines an dev server but just not on the live.
Incidentally it seems to break after the JIT compiler runs on the server after a web.config update or an app pool recycle, or even just a long period of time!
UPDATE: Our live servers run all websites from a share location. I managed to replicate this issue on another server running the application from a share. When setting the site to run from a local drive the issue goes away but our hosting requires us to run from a share. Any ideas why log4net would have permissions issues running from a share. Again the app runs first time until another JIT compilation occurs