Asp.net mvc 2 Window2008r2 MVC2项目上的Elmah webconfig错误500

Asp.net mvc 2 Window2008r2 MVC2项目上的Elmah webconfig错误500,asp.net-mvc-2,elmah,sql-server-2008-r2,Asp.net Mvc 2,Elmah,Sql Server 2008 R2,刚刚发现我不需要在system.web中使用httpHandler和httpHandler,它仍然在运行 <httpModules> <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/> <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" /> </httpModules> <customErrors mo

刚刚发现我不需要在system.web中使用httpHandler和httpHandler,它仍然在运行

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />
我曾尝试将Elmah集成到我的MVC2项目中,它在我的本地系统上运行良好,但当我将它上传到Web时,它就是window2008-r2。在那里我得到了“500-内部服务器错误”

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />
当我从webconfig中删除httpHandler和httpHandler时,错误消失了,但elmah没有运行

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />
请帮忙,我是如何让它在2008RC上运行的

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />
以下是我的webconfig文件中的内容:

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />

... ...

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />

。。。

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />

...

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />

我猜您在2008年的机顶盒上使用的是.net 4.0,而此模块与.net 4不兼容

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />
我所做的就是下载源文件并将其编译为.NET4,没有任何问题。我目前正在使用.NET4.0在Server2008上运行Elmah,一切正常

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />
作为参考,这里是我的web.config文件的摘录

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />
<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>

<elmah>
  <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ConnectionString" />
  <security allowRemoteAccess="0" />    
</elmah>
<location path="elmah.axd">
<system.web>
    <authorization>
      <deny users="?" />
    </authorization>
    <httpRuntime requestLengthDiskThreshold="256" maxRequestLength="2097151" />
  </system.web>
</location>

<system.web>
<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"/>
<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中是否需要HttpHandler取决于您是否在IIS6上……最好按照示例中所示保留这两部分,以便它在IIS6和IIS6上都能正常工作

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</httpModules>


<customErrors mode="RemoteOnly" defaultRedirect="/content/error.htm" />