Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
795 views
in Technique[技术] by (71.8m points)

asp.net mvc - 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="change.me@CCCC.org" to="brown.ericw@CCCC.org" 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-

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...