简体   繁体   English

Elmah在生产时给出错误代码500,但在旧主机/本地开发中却给出错误代码500

[英]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. 我不知道如何让Elmah在Asp.net MVC项目的生产主机上工作。 Locally and on my last host, everything is setup correctly and going to /Elmah.axd successfully brings up the error logger. 在本地和我的最后一台主机上,一切/Elmah.axd正确设置,并成功进入/Elmah.axd会打开错误记录器。 However, on production host it is giving me a 500 error code. 但是,在生产主机上,它给我一个500错误代码。 I don't know what else to do to debug the issue. 我不知道该如何解决该问题。 My web.config looks like: 我的web.config看起来像:

<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.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: 您可能会忘记使用以下规则来更新RegisterRoutes

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? 这些链接可能会帮助您http://code.google.com/p/elmah/wiki/MVC以及如何使ELMAH与ASP.NET MVC [HandleError]属性配合使用?

The event log should be able to give you more information on what the error 500 is. 事件日志应该能够为您提供有关错误500是什么的更多信息。 Obviously the best thing would be to attach a debugger to the IIS instance but I'm guessing that's not possible! 显然,最好的办法是将调试器附加到IIS实例,但是我猜这是不可能的!

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. 要检查的另一件事是两个服务器是x86还是x64,即使ELMAH是平台无关的,它的某些依赖性也不是。

Here is how you debug a 500 error on IIS: 这是在IIS上调试500错误的方法:

In IE GOTO: Internet options -> Advanced -> Disable: Show friendly HTTP error messages IE GOTO中:Internet选项->高级->禁用:显示友好的HTTP错误消息

After that you get a normal error you can debug :-) 之后,您得到一个正常错误,您可以调试:-)

进阶网际网路选项
(source: communitymx.com ) (来源: communitymx.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM