0

I have been using log4Net to write in a text file when there is any exception in my web service, this was working but today it started to throw error.

System.Web.Services.Protocols.SoapException: Server was unable to

process request. ---> System.TypeInitializationException: The type initializer for.. threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905'

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].

If you have any inputs on this stack info, pls. share it.

Sharpeye500
  • 8,775
  • 25
  • 95
  • 143
  • It looks like your log4net.dll got overwritten, possibly with a different version. Can you verify that the log4net.dll that your web service is using is version is 1.2.9.0? You can also check that the PublicKeyToken matches by using the sn.exe tool included with Visual Studio (sn.exe -T log4net.dll). – rsbarro Aug 17 '11 at 20:38
  • This is what i get as an error: log4net:Error XMLConfigurator:Failed to find configuration section 'log4net' in the applications's .config file. Check your .config file for the and . The configuration section should look like:
    I checked my web.config, this is correctly looking for me:
    – Sharpeye500 Aug 17 '11 at 20:54
  • Wait, are you running the right version (1.2.9.0)? Did you try adding the config section as suggested? – rsbarro Aug 18 '11 at 15:46

1 Answers1

0

Did you change the code, or did this just start happening?

I've seen this error occur when the target processor architecture was mismatched. Did you change that by any chance?

If this isn't the case, and you have Windows SDK installed, you can use the Fusion Log Viewer to view assembly binding logs. The utility should be installed on your machine.

Kris Harper
  • 5,672
  • 8
  • 51
  • 96