Elmah giving error code 500 on production, but not on old host/local development
I can't figure out how to get Elmah working on my production host for my Asp.net MVC project. Locally and on my last host, everything is setup correctly and going to /Elmah.axd
successfully brings up the error logger. However, on production host it is giving me a 500 error code. I don't know what else to do to debug the issue. My web.config looks like:
<configSections&g开发者_高级运维t;
<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.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
</modules>
<handlers>
<add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</handlers>
</system.webServer>
<system.web>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
</httpModules>
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
</system.web>
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="MyDbContext" />
</elmah>
You might forget to update RegisterRoutes
with the following rule:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("elmah.axd");
}
Those links might help you http://code.google.com/p/elmah/wiki/MVC and How to get ELMAH to work with ASP.NET MVC [HandleError] attribute?
The event log should be able to give you more information on what the error 500 is. Obviously the best thing would be to attach a debugger to the IIS instance but I'm guessing that's not possible!
Another thing to check will be whether both servers are x86 or x64, as even though ELMAH is platform independent some of it's dependencies aren't.
Here is how you debug a 500 error on IIS:
In IE GOTO: Internet options -> Advanced -> Disable: Show friendly HTTP error messages
After that you get a normal error you can debug :-)
(source: communitymx.com)
精彩评论