Vague
Vague

Reputation: 2280

Elmah MVC Could not load file or assembly Elmah.SqlServer

I installed elmah.mvc.2.1.2 from the nuget package manage console. I ran the script ELMAH-1.2-db-SQLServer.sql to modify the database.

To the configuration section of web.config I added

<elmah>
    <errorLog type="Elmah.SqlErrorLog, Elmah.SqlServer" connectionStringName="DefaultConnection"/>
</elmah>

I know that DefaultConnection works for everything else we do in the app.

I have programmed an action /Home/TestError that throws an error. The error is thrown but no entry is made in the database. When I navigate to /elmah I get the error Could not load file or assembly 'Elmah.SqlServer' or one of its dependencies.

I reinstalled Elmah from package manager console but it made no difference. There is no Elmah.SqlServer in the bin folder so I cannot add the reference manually.

Upvotes: 0

Views: 518

Answers (1)

ThomasArdal
ThomasArdal

Reputation: 5259

The SqlErrorLog is located in the Elmah assembly (not Elmah.SqlServer). Try the following:

<elmah>
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="DefaultConnection"/>
</elmah>

Upvotes: 1

Related Questions