开发者

ELMAH / Server 2008 / IIS 7.5 / MVC 2 : 500 - Internal server error

开发者 https://www.devze.com 2023-02-10 21:52 出处:网络
I\'ve been trying to resolve a 404 error received when trying to access ELMAH.axd. The ELMAH email functionality worked, but I could not navigate to the axd. Now, I\'m getting 500.22 - Internal server

I've been trying to resolve a 404 error received when trying to access ELMAH.axd. The ELMAH email functionality worked, but I could not navigate to the axd. Now, I'm getting 500.22 - Internal server error. Can someone spot the error in my code or suggest some recourse short of disabling ELMAH?

 <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"/>
    <section name="errorTweet" requirePermission="false" type="Elmah.ErrorTweetSectionHandler, Elmah"/>
  </sectionGroup>

<system.web>

<authentication mode="Windows" />
  <authorization>
    <allow roles="ViewOnly,Admins" />
    <deny users="*" />
  </authorization>

<elmah>
    <security allowRemoteAccess="1" />
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ElmahConnectionString" />
    <!-- email configured here -->
</elmah>

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
  <add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah"/>
  <add name="ErrorFilter" type="开发者_JS百科Elmah.ErrorFilterModule, Elmah"/>
</httpModules>

<httpHandlers>
  <add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
  <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />    
</httpHandlers>
</system.web>

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

<location path="elmah.axd">
<system.web>
  <authorization>
    <deny users="*" />
  </authorization>
</system.web>
</location>

And in Global.asax:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

I'm using a database to record ELMAH data.

What am I missing? I've read so many posts and it seems that there is no one right answer, I suppose given the several ways applications and servers can be configured.


The error you are seeing definitely looks like a configuration issue.

HTTP 500.22 - "An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode."

I found this link that provides some details on breaking changes in II7. More details specific to the web.config can be found here.

Do you have the ELMAH handler configured in the system.webSever section of your web.config? If not, I believe adding it should resolve your issue:

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


All I can see is that:

  1. You are trying to make ELMAH logging errors into a database, but the connection string ElmahConnectionString is not defined anywhere. BTW, you should start trying to use logPath="~/App_Data" instead; if all runs well, then implement the database connection.
  2. deny users = "*" means deny everyone; deny users = "?" means deny unauthenticated users. I guess what you want is the latter.


What mode is your application pool running in (classic or integrated)? I had this problem and found that Elmah started working after I change my app pool to integrated mode.

0

精彩评论

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

关注公众号