2012-12-12 33 views
2

我在我的web.config以下:試圖執行ELMAH - 不斷得到IIS HTTP 500.22錯誤

<?xml version="1.0" encoding="utf-8"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=169433 
    --> 
<configuration> 
    <configSections> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    <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> 
    </configSections> 
    <elmah> 
    <security allowRemoteAccess="yes" /> 
    <errorLog type="Elmah.SqlErrorLog, Elmah" 
    connectionStringName="PhumafConnectionString" /> 
    <errorMail 
     from="*******" 
     to="*********" 
     subject="Application Exception" 
     async="false" 
     smtpPort="0" 
     useSsl="true" /> 
    </elmah> 
    <system.net> 
    <mailSettings> 
     <smtp deliveryMethod="Network"> 
     <network host="smtp.gmail.com" port="587" userName="*********" password="********" /> 
     </smtp> 
    </mailSettings> 
    </system.net> 
    <connectionStrings> 
    <add name="PhumafEntities" connectionString="metadata=res://*/PhumafDB.csdl|res://*/PhumafDB.ssdl|res://*/PhumafDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DRAGAN-THINK\SQLEXPRESS;initial catalog=Phumaf;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework&quot;" 
     providerName="System.Data.EntityClient" /> 
    <add name="PhumafConnectionString" connectionString="Data Source=DRAGAN-THINK\SQLEXPRESS;Initial Catalog=Phumaf;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework" 
     providerName="System.Data.SqlClient" /> 
    </connectionStrings> 
    <system.web> 
    <customErrors mode="On" defaultRedirect="~/genericError.aspx"> 
     <error statusCode="404" redirect="~/404.aspx" /> 
    </customErrors> 
    <httpHandlers> 
     <add verb="POST,GET,HEAD" path="elmah.axd" 
    type="Elmah.ErrorLogPageFactory, Elmah" /> 
    </httpHandlers> 
    <httpModules> 
     <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" /> 
     <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" /> 
    </httpModules> 
    <compilation debug="true" targetFramework="4.5"> 
     <assemblies> 
     <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
     </assemblies> 
    </compilation> 
    <httpRuntime targetFramework="4.5" /> 
    </system.web> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> 
    </entityFramework> 
</configuration> 

我也加入Elmah.dll到bin文件夾。每當我運行應用程序,我得到了IIS錯誤畫面包含以下信息:

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

Most likely causes: 
This application defines configuration in the system.web/httpModules section. 

Detailed Error Information: 
Module  ConfigurationValidationModule 
Notification  BeginRequest 
Handler PageHandlerFactory-Integrated-4.0 
Error Code  0x80070032 
Requested URL  http://localhost:13094/index.aspx 
Physical Path  c:\users\dragan\documents\visual studio 2012\Projects\WebApplication2\WebApplication2\index.aspx 
Logon Method  Not yet determined 
Logon User  Not yet determined 
Request Tracing Directory  C:\Users\Dragan\Documents\IISExpress\TraceLogFiles\WEBAPPLICATION2 

驗證了我的XML是有效的,它是100%有效:/

我真不不知道出了什麼問題。在我嘗試實施Elmah之前,它一直都可以。我開始失去主意,如果你看到我做錯了什麼,請幫忙。

+0

我看不出有什麼毛病了蝙蝠的權利,但我會建議你開始註釋掉大塊的web.config直到你縮小到它正在抱怨什麼。 – CodingGorilla

+0

當我註釋掉httphandlers和httpmodules節時,我得到索引。我忽略了他們中的任何一個,我得到了同樣的錯誤:/ – Dragan

回答

11

退房以下兩個鏈接 http://code.google.com/p/elmah/issues/detail?id=231

http://mvolo.com/breaking-changes-for-aspnet-20-applications-running-in-integrated-mode-on-iis-70

解決該錯誤如下所述的基本組成部分

1)ASP.NET應用程序指定時需要遷移配置在或。 您將收到500 - 內部服務器錯誤。這可能包括HTTP錯誤500.22和HTTP錯誤500.23:已檢測到ASP.NET設置不適用於集成管理管道模式。 它發生的原因是ASP.NET模塊和處理程序應該在集成模式下的IIS和配置節中指定。 解決方法: 1)您必須遷移應用程序配置才能在集成模式下正常工作。你可以用APPCMD遷移應用程序配置:

%WINDIR%system32inetsrvAppcmd遷移配置「」