Elmah 1.2 does not log to SQL on Windows 2008 IIS7.5 Integrated mode (but works locally)

穿精又带淫゛_ 提交于 2019-12-20 03:50:51

问题


I'm building a new Web Forms aspnet 4.0 website and have installed Elmah 1.2 using NuGet. I've added a line to the web.config to log to sql server express, and created the relevant table and 3 stored procs. Locally (Win 7/ IIS 7.5) everything works well (when run through vs2010 dev server, and my local IIS)- I can hit elmah.axd/test then return to elmah.axd and, sure enough, my error has been logged.

I then publish the site up to our dev server (Win 2008 R2/ IIS 7.5). If I hit elmah.axd it informs me there are no errors- I then go to elmah.axd/test and return to Elmah, and still no errors. If I switch the logging to be to memory instead of SQL everything works fine.

I have added execute rights to the app pool user for all stored procs in the site. I even created a separate connection string called ElmahConnString, logging in as SA- still no luck. (I tried deleting the a from sa to ensure it broke, and sure enough it broke- so it was definitely using that conn string).

My web config looks like this (most of this was put in my NuGet!);

    <configuration>
      <configSections>
        <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>

    ...
      <connectionStrings>
        <add name="ConnString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=SiteData;Integrated Security=True" />
      </connectionStrings>
      <elmah>
        <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ConnString" />
        <security allowRemoteAccess="yes" requirePermission="false"/>
      </elmah>
    ...
      <system.web>
        <httpModules>
          <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
          <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
          <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
        </httpModules>
        <httpHandlers>
          <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory,         Elmah" />
        </httpHandlers>
    ...
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules>
          <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
          <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
          <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
          <add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah" preCondition="managedHandler" />
        </modules>
        <handlers>
          <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
        </handlers>
      </system.webServer>

You'll notice this encompasses the most widly given answer for this problem which is that system.webserver chunk at the bottom :'(

I don't get it? What am I missing?


回答1:


You can't insert into the database but it's not a sql permissions problem?

  • Maybe your disk's full.
  • Maybe you've created a table without an IDENTITY column where there should be one.

Seriously - you couldn't wait two WHOLE MINUTES for an answer? Maybe it is inserting into the database, but you're checking too quickly.



来源:https://stackoverflow.com/questions/6582818/elmah-1-2-does-not-log-to-sql-on-windows-2008-iis7-5-integrated-mode-but-works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!