开发者

ELMAH 1.2 Works great on CASSINI but I'm not able to make it works on IIS 7.5

I use asp.net 4 and C# as logging error solution I use ELMAH 1.2.

I was able to use properly ELMAH on my local computer using CASSINI in Visual Studio 2010 but I as soon I move the website to a Server with IIS 7 or IIS 7.5 (locally or remotely) ELMAH is not able to record any errors. No error or yellow pages show up.

I suppose there is some problem with configurations, even I read many tutorials I'm still not able to make it works on production environment. Here my Web.Config. Could you tell me what I'm doing wrong?

NOTES: I removed here the connection string for security, but on cassini work great Thanks

  <?xml version="1.0"?>
    <configuration>
        <configSections>
            <section name="myWebAppSettings" type="System.Configuration.SingleTagSectionHandler"/>
            <!-- Elmah Local-->
            <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 Local -->
        </configSections>
        <system.webServer>
            <!-- Elmah > IIS 7 -->
            <validation validateIntegratedModeConfiguration="false"/>
            <modules>
                <add name="Elmah.ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
            </modules>
            <handlers>
                <add name="Elmah" path="Admin/elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
            </handlers>
            <!-- / Elmah > IIS 7 -->
            <directoryBrowse enabled="false"/>
            <httpErrors errorMode="Custom">
                <remove statusCode="404" subStatusCode="-1"/>
                <remove statusCode="500" subStatusCode="-1"/>
                <error statusCode="404" path="/ErrorPages/404.aspx" prefixLanguageFilePath="" responseMode="ExecuteURL"/>
                <error statusCode="500" path="/ErrorPages/Error.aspx" prefixLanguageFilePath="" responseMode="ExecuteURL"/>
            </httpErrors>
        </system.webServer>
        <connectionStrings>
        </connectionStrings>
        <!-- Elmah -->
        <elmah>
            <security allowRemoteAccess="1" />
            <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="XXXXX" />
        </elmah>
        <!-- / Elmah -->
        <!-- Deny access to Admin Tools -->
        <location path="Admin">
            <system.web>
                <authorization>
                    <allow roles="CMS-ADMINISTRATOR"/>
                    <deny users="*"/>
                </authorization>
            </system.web>
        </location>
        <!-- / Deny access to Admin Tools -->
        <system.web>
            <!-- Elmah -->
            <httpHandlers>
                <add verb="P开发者_高级运维OST,GET,HEAD" path="Admin/elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
            </httpHandlers>
            <httpModules>
                <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
            </httpModules>
            <!-- / Elmah -->
            <customErrors mode="Off"></customErrors>
            <globalization culture="en" uiCulture="en"/>
            </pages>
            <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
                <assemblies>
                    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                    <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="WebProject.Core"/>
                    <add assembly="WebProject.DataAccess"/>
                    <add assembly="WebProject.Cms"/>
                    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Data.Services.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                </assemblies>
            </compilation>
            <authentication mode="Forms">
                <forms loginUrl="~/Login.aspx" timeout="2880"/>
            </authentication>
            <roleManager enabled="true" cacheRolesInCookie="true">
                <providers>
                    <clear/>
                    <add connectionStringName="XXXXX" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
                </providers>
            </roleManager>
            <membership>
                <providers>
                    <clear/>
                    <add name="AspNetSqlMembershipProvider" connectionStringName="XXXXX" applicationName="/" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="3" minRequiredPasswordLength="16" minRequiredNonalphanumericCharacters="4" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
                </providers>
            </membership>
        </system.web>
    </configuration>


One difference between the configuration I use & the one you use, is your modules section is missing a property runAllManagedModulesForAllRequests="true"; that is, my modules section is as follows:

<modules runAllManagedModulesForAllRequests="true">
    <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
    <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
    <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
    <add name="IIS7AppVersioningModule" type="IIS7AppVersioningModule.AppVersionModule,IIS7AppVersioningModule" />
</modules>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜