C# 从并行操作调用log4net时崩溃

C# 从并行操作调用log4net时崩溃,c#,log4net,C#,Log4net,我有一个使用log4net的解决方案,它在我的应用程序中都是使用Windsor Castle IOC框架实例化的。它的工作,接受一个案件 我的架构: CoreLib ILogger Logger WebLib web.config (log4net settings) MailServiceLib MailService 有问题的代码(WebLib内部): 运行它的计算机的事件日志如何?我得说你得把它锁起来。。考虑到它可能记录到一个文件?只是一个警告。iisexpress

我有一个使用log4net的解决方案,它在我的应用程序中都是使用Windsor Castle IOC框架实例化的。它的工作,接受一个案件

我的架构:

CoreLib
  ILogger
  Logger

WebLib
  web.config  (log4net settings)

MailServiceLib
  MailService
有问题的代码(WebLib内部):


运行它的计算机的事件日志如何?我得说你得把它锁起来。。考虑到它可能记录到一个文件?只是一个警告。iisexpress\IIS临时压缩文件\Clr4IntegratedAppPool无效。正在禁用静态压缩。可能是因为iisexpress退出了?据我所知log4net文件记录器是线程安全的?厌倦了使用锁,但似乎没有成功difference@aleksey.berezan谢谢,但是我已经试过log4net内部调试了
MailService.Ctor() { _log = IoC.Resolve<ILogger>(); }
MailService.Send(...)
...
_log.Info("this always works..");
Parallel.ForEach(to, po, address => {
    _log.Info("BAP!!"); 
    _log.Info("KAPOW!!"); // <-- this works on first loop, but exists the process sometime after with no exceptions being caught or errors logged anywhere 
    ...
    client.Send(msg);
lock (_logLock) {
    _log.Info("sent");
}