View on GitHub

Elmah SQL Server Initializer

Automatically creates an Elmah database on SQL Server using Entity Framework migrations.

Download this project as a .zip file Download this project as a tar.gz file


This project is available as a NuGet package. It can be installed from the Visual Studio Package Manager Console using Install-Package Elmah.SqlServer.EFInitializer.


By default the database will be created using the DefaultConnection connection string.

If you wish to use a different connection string, you should declare a named string in the connectionStrings section of Web.config and edit the connectionStringName attribute on the elmah / errorLog configuration element. For example:

  <!-- Other configuration omitted -->
    <add name="ElmahConnection"
         connectionString="Data Source=(local);Initial Catalog=Elmah;Integrated Security=True;"
         providerName="System.Data.SqlClient" />
    <errorLog type="Elmah.SqlErrorLog, Elmah" 
              connectionStringName="ElmahConnection" />

Usage note

The intent of this package is only to automate the creation of a backing SQL Server database for Elmah and provide enough configuration to do the basic logging. Errors will be logged to the database, but you will also need to install something like the main Elmah package or Elmah.MVC to view them within the site.


Credit must go to the creators of Elmah.SqlServer, the SQL from that project is what I used for the migrations.