开发者

Elmah webconfig error 500 on Window2008r2 MVC2 Project

开发者 https://www.devze.com 2023-01-28 10:33 出处:网络
Just found out that i don\'t need httpHandler and the httpHandlers in the system.web and it still running

Just found out that i don't need httpHandler and the httpHandlers in the system.web and it still running

I have tried to integrate Elmah to my MVC2 Project and it works fine on my local, But when I upload it to the Web, which is window2008-r2. There i get "500 - Internal server error."

When i remove the httpHandler and the httpHandlers from the webconfig the the error is gone but elmah is not running.

Please help, how you I get it running on the 2008RC?

Here is what in my webconfig file:

  <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.ErrorFilterSec开发者_StackOverflow中文版tionHandler, Elmah"/>
  <section name="errorTweet" requirePermission="false" type="Elmah.ErrorTweetSectionHandler, Elmah"/>
</sectionGroup>

... ...

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


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

... ...

<modules runAllManagedModulesForAllRequests="true">
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
</modules>


<handlers>
  <add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
  <remove name="UrlRoutingHandler"/>
</handlers>

...

<security allowRemoteAccess="0" />

<!--
  quickest log method
  -->
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/Content/ErrorLog" />

...


I am going to guess you are using .net 4.0 on your 2008 box and this module is not compatible with .net 4

What I did is download the source files and compiled it as .net 4 and had no issues. I am currently running Elmah on server 2008 using .net 4.0 and all is working just fine.

Just as a reference here is an excerpt from my web.config file

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


whether or not httpHandlers is required in system.web is determined by whether you are on IIS6....It is better you keep both pieces as shown in the example by odyth so that it works fine for both IIS 6 and 7

0

精彩评论

暂无评论...
验证码 换一张
取 消