Installation
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
.
Configuration
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:
<configuration>
<!-- Other configuration omitted -->
<connectionStrings>
<add name="ElmahConnection"
connectionString="Data Source=(local);Initial Catalog=Elmah;Integrated Security=True;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah"
connectionStringName="ElmahConnection" />
</elmah>
</configuration>
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.
Acknowledgements
Credit must go to the creators of Elmah.SqlServer, the SQL from that project is what I used for the migrations.