Elmah Weirdness

I had this strange Elmah problem that was very annoying but was documented, however it wasn't obvious - to me anyway!

The problem

First off, let me describe the problem. I had the following setup in web.config:

<connectionStrings>
  <add name="elmah.db" connectionString="data source=~/App_Data/elmah.db" />
</connectionStrings>

<elmah>
  <security allowRemoteAccess="1" />
  <errorLog type="Elmah.SQLiteErrorLog, Elmah" connectionStringName="elmah.db" />
</elmah>

<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />

All worked perfectly locally, however on uploading to my hosting provider, navigating to elmah.axd, all I got was a page that can only be described as garbage: just a load of control characters and such...

ElmahSQLiteError

Also, the elmah.db file wasn't getting created, so something weird was going on.

Red Herring

I'd had some problems when I upgraded from a 32 to 64 bit OS, so I spent some time going round in circles trying different dll's - all without success.

Finally, after some searching and RTFM-ing, I realised the problem is that my hosting provider enforces partial trust, however, SQLite requires full trust.

So, essentially, there is no solution - you simply can't use Elmah with SQLite in this scenario. However, it is simple to switch to an alternative error log implementation.

I was already using SQLServer so I simply added the necessary tables using the script provided, and then changed the web.config as follows:

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

With that simple change, Elmah is now working as expected. Simple when you know the answer!


Comment Guidelines
See the FAQ for details on the full rules and guidelines. No Spam. Write clearly and thoughtfully - no bad language.