ELMAH 1.2在CASSINI上可以很好地工作,但是我无法使其在IIS 7.5上工作 [英] ELMAH 1.2 Works great on CASSINI but I'm not able to make it works on IIS 7.5

查看:65
本文介绍了ELMAH 1.2在CASSINI上可以很好地工作,但是我无法使其在IIS 7.5上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用asp.net 4和C#作为记录错误解决方案,我使用 ELMAH 1.2 .

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

我能够在Visual Studio 2010中使用CASSINI在本地计算机上正确使用ELMAH,但是我将网站移到具有IIS 7或IIS 7.5的服务器上(本地或远程)后,ELMAH无法记录任何错误.没有错误或出现黄页.

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.

我想配置存在一些问题,即使我阅读了很多教程,我仍然无法使其在生产环境中正常工作.这是我的Web.Config.你能告诉我我在做什么错吗?

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="POST,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>

推荐答案

我使用的&配置之间的一个区别您使用的是您的 modules 部分缺少属性 runAllManagedModulesForAllRequests ="true" ;也就是说,我的模块部分如下:

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>

这篇关于ELMAH 1.2在CASSINI上可以很好地工作,但是我无法使其在IIS 7.5上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆