Re: Getting Started

109 views
Skip to first unread message

James_2JS

unread,
Apr 2, 2013, 2:48:38 PM4/2/13
to el...@googlegroups.com
Hi Darrell,

Yes, you're going to need to post your web.config here (taking out any sensitive info first)!
Also, what platform are you running on?

Cheers,

James

On Tuesday, April 2, 2013 7:27:39 PM UTC+1, Darrell Elliott wrote:
Hello and Good Afternoon,

I am very new to Elmah, but I certainly like what I see! At the moment, and the last couple of days, I seemed to be stuck on a very simple issue. I have downloaded the Elmah_TestHarness solution and that works great! Then I have created a new web app and added references to Elmah and I have made sure the config file is the exact same as what is in the example. In my web app, the errors are logged to the Event Viewer, but not logged in Sql Server. I can copy my web.config file and the other source code here, but it is the same as what is in the example. I was just wondering if anyone out there would have a solution to my problem. I think I have been looking at this too long myself and need a fresh perspective!

Thanks much in advance!

Darrell Elliott

unread,
Apr 2, 2013, 2:55:26 PM4/2/13
to el...@googlegroups.com
James,

Thanks much for the reply! Below is my config file and I am using VS 2012 and .NET 4.0

<configuration>
  <configSections>
    <sectionGroup name="elmah">
      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
      <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
      <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
    </sectionGroup>
  </configSections>
  <connectionStrings>
    <add name="elmah-express" connectionString="Data Source=.;User=***;Password=***;Initial Catalog=***;Persist Security Info=True;" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <elmah>
    <security allowRemoteAccess="0"/>
    <errorLog type="Elmah.SqlErrorLog, Elmah"
             connectionStringName="elmah-express" />
    <errorFilter>
      <test>
        <equal binding="HttpStatusCode" value="404" valueType="Int32" />
      </test>
    </errorFilter>
  </elmah>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpHandlers>
      <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
    </httpHandlers>
    <httpModules>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
    </httpModules>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>
</configuration>

James_2JS

unread,
Apr 2, 2013, 3:08:20 PM4/2/13
to el...@googlegroups.com
Hi Darrell,

No worries! :O)

OK... here's what I think you're missing...
You need to add the relevant ELMAH settings in system.webServer too, e.g.:

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah" preCondition="managedHandler" />
</modules>
</system.webServer>

But given you are using VS2012, you might find life much, much easier if you use the nuget packages.
There's one for SQL Server that will fill out most of what you need without any fuss!!

Cheers,

James

Darrell Elliott

unread,
Apr 2, 2013, 3:11:06 PM4/2/13
to el...@googlegroups.com
Thanks James.

I have tried the NuGet packages for SQL Server and I get a different error entirely. I will start a fresh project quickly and give that another go. I will post back if there are any issues. Thanks for your time, Sir! :)

Darrell Elliott

unread,
Apr 2, 2013, 3:23:32 PM4/2/13
to el...@googlegroups.com
Ok, so I started up a new project quickly and now I am receiving this error after installing all of the NuGet packages from 'Install-Packages Elmah.SqlServer:

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


<configuration>
  <configSections>
    <sectionGroup name="elmah">
      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
      <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
      <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
    </sectionGroup>
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpModules>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />

    </httpModules>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <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>
  </system.webServer>
  <elmah>
    <!--
        See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
        more information on remote access and securing ELMAH.
    -->
    <security allowRemoteAccess="false" />
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="elmah-sqlserver" />
  </elmah>
  <location path="elmah.axd" inheritInChildApplications="false">
    <system.web>

      <httpHandlers>
        <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
      </httpHandlers>
      <!--
        See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
        more information on using ASP.NET authorization securing ELMAH.

      <authorization>
        <allow roles="admin" />
        <deny users="*" /> 
      </authorization>
      -->
    </system.web>
    <system.webServer>
      <handlers>
        <add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
      </handlers>
    </system.webServer>
  </location>
  <connectionStrings>
    <!-- TODO: Replace the ****'s with the correct entries -->
    <add name="elmah-sqlserver" connectionString="Data Source=.;User ID=***;Password=***;Initial Catalog=***;" providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>

Darrell Elliott

unread,
Apr 2, 2013, 3:34:38 PM4/2/13
to el...@googlegroups.com
Ok, forget the last post. I foolishly named my new project ELMAH. DUH! Lol...
Reply all
Reply to author
Forward
0 new messages