2010-11-29 69 views
1

剛剛發現我並不需要的HttpHandler和對System.Web的HttpHandlers的,它仍然運行ELMAH上Window2008r2 MVC2項目webconfig錯誤500

我曾經試圖整合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

我要你使用的是.NET 4.0的2008箱猜測這個模塊與.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> 
0

是否HttpHandlers的摘錄中的System.Web需要由您是否在IIS6確定....這是更好你保留兩部分,如odyth的示例所示,這樣它對IIS 6和7都可以正常工作。