Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load type 'Elmah.ErrorLogModule' from assembly 'Elmah'

I have basically loaded Elmah assemblies and installed the package using the NuGet plug-in. I remember it working with one of my project but suddenly it stopped working with

"Could not load type 'Elmah.ErrorLogModule' from assembly 'Elmah'."

error and that is weird. It used to work. Anyways I did not find many solutions to it on Google but I think people have faced this problem before. some suggested it is 32 bit 64 bit version issue.

Any suggestions?

like image 899
Lost Avatar asked Dec 07 '11 02:12

Lost


3 Answers

Actually guys it turned out that it was a silly reason basically. It stopped working because I used the same name Elmah for my project as the assembly.

That made the whole thing stop working. A really silly mistake.

like image 173
Lost Avatar answered Sep 28 '22 14:09

Lost


This can happen if Elmah was added manually before and the assembly binding in the web.config references a specific version:

This -

<modules>
    <add name="ErrorMail" preCondition="managedHandler" type="Elmah.ErrorMailModule, Elmah-1.1"/>
    <add name="ErrorLog" preCondition="managedHandler" type="Elmah.ErrorLogModule, Elmah-1.1"/>
    <add name="ErrorFilter" preCondition="managedHandler" type="Elmah.ErrorFilterModule, Elmah-1.1"/>
</modules>

Should be this -

<modules runAllManagedModulesForAllRequests="true">
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
  <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
like image 27
Gary.S Avatar answered Sep 28 '22 15:09

Gary.S


" I remember it working with one of my project but suddenly it stopped..."

You have install the NuGet Elmah package for each project using it.

like image 26
rick schott Avatar answered Sep 28 '22 16:09

rick schott