Enterpriselibrary : The process cannot access the file because it is being used by another process

1

I have 10 .net consoles starting up on the same time in the same folder. All 10 processes starts by writing startup info (via EnterpriseLibrary) to 10 different log files. The EnterpriseLibrary dll's are released next to the console .exe

Sometimes I get this Exception, when i call Write. The problem is that .net cannot load the EnterpriseLibrary reference. I'm not sure how to deal with this?

System.TypeInitializationException: The type initializer for 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020) File name: 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=null' at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory..cctor()

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

--- End of inner exception stack trace --- at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IConfigurationSource configurationSource) at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterFactory.Create() at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.get_Writer() at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry log)

c#
logging
asked on Stack Overflow May 16, 2011 by Stig • edited May 16, 2011 by Stig

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0