Search code examples
asp.net-mvcvisual-studio-2010.net-4.0windows-server-2008elmah

Elmah, convert to .Net4 vs2010, run on server 2008, does not work


So I've been using elmeh forever.

I've got an app I've recently converted to MVC3 .net4, and vs2010, and it's developed on a server 2008 box (as opposed to my other apps developed on an XP box).

I set up elmah normally and it does not work...

I've got a reference to ELMAH.dll already, it's in my CommonDLLs folder.

I add the sectiongroups

<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>

I add the sections

<elmah>
    <security allowRemoteAccess="1" />
    <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/ELMAH" />
    <!--<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />-->
    <errorMail from="[email protected]" to="[email protected]" subject="Application: StudentPortal3G,  Environment:Dev, ServerBoxName: Dev" async="true" />
</elmah>

I add the module and handlers

<httpHandlers>
            <add verb="*" path="*.pdfx" type="JCDCHelper.Web.UI.RunAsASPXHandler, JCDCHelper.Web" />
            <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>

I add the SMTP section for Email support

 <system.net>
    <!--Required for Elmah Mail Processing-->
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network host="10.10.10.10" port="25" defaultCredentials="true" />
      </smtp>
    </mailSettings>
  </system.net>

I goto the "~\ELMAH" folder, select my machine, and give the network service account full control of the folder (did the same for Everyone, just in case)

I set up the routing for elmah.axd to go throguh as a web page.

    routes.IgnoreRoute("elmah.axd");

I add a location tag, so I can hit elmah.axd without being logged in

<location path="elmah.axd">
    <system.web>
      <authorization>
        <!--<deny users="?" /> in prod and qa change to this, otherwise anyoen can look at the logs - EWB-->
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

But I get nothing, no elmah emails, no XML logs in the ELMAH folder, and a 404 when I goto elmah.axd

What am I missing? ANy help is appreaicted.

Thanks,

Cal-


Solution

  • Under IIS7 you need to add the httpHandlers and httpModulea under the system.webserver node of the web.config.

    This thread should help: http://groups.google.com/group/elmah/browse_thread/thread/4bbef2f26e0c5fd1