刚刚发现我不需要http.andb中的httpHandler和httpHandlers,它仍在运行
我试图将Elmah集成到我的MVC2项目中,它在我的本地工作正常,但是当我将它上传到Web,即window2008-r2。我得到“500 - 内部服务器错误。”
当我从webconfig中删除httpHandler和httpHandlers时,错误消失但elmah没有运行。
请帮忙,我如何让它在2008RC上运行?
以下是我的webconfig文件中的内容:
<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>
... ...
<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" />
...
答案 0 :(得分:0)
我猜你在2008年的盒子上使用.net 4.0而且这个模块与.net 4不兼容
我所做的是下载源文件并将其编译为.net 4并且没有任何问题。我目前正在使用.net 4.0在服务器2008上运行Elmah,所有工作正常。
就像这里的参考是我的web.config文件的摘录
<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>
答案 1 :(得分:0)
是否在system.web中需要httpHandlers取决于你是否在IIS6上......最好保留odyth示例中所示的两个部分,以便它可以正常工作IIS 6和7