开发者

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

开发者 https://www.devze.com 2023-03-17 04:15 出处:网络
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

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=.\SQLEXPRE开发者_StackOverflow社区SS;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?


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.

0

精彩评论

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