问题描述
我正在构建一个新的 Web Forms aspnet 4.0 网站,并使用 NuGet 安装了 Elmah 1.2.我在 web.config 中添加了一行以登录到 sql server express,并创建了相关表和 3 个存储过程.在本地(Win 7/IIS 7.5)一切正常(当通过 vs2010 开发服务器和我的本地 IIS 运行时) - 我可以点击 elmah.axd/test 然后返回到 elmah.axd,果然,我的错误已被记录.
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.
然后我将站点发布到我们的开发服务器(Win 2008 R2/IIS 7.5).如果我点击 elmah.axd,它会通知我没有错误——然后我去 elmah.axd/test 并返回 Elmah,仍然没有错误.如果我将日志记录切换到内存而不是 SQL,则一切正常.
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.
我已为应用程序池用户添加了站点中所有存储过程的执行权限.我什至创建了一个名为 ElmahConnString 的单独连接字符串,以 SA 身份登录 - 仍然没有运气.(我尝试从 sa 中删除 a 以确保它坏了,果然它坏了 - 所以它肯定使用了那个 conn 字符串).
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).
我的网络配置看起来像这样(其中大部分都放在我的 NuGet 中!);
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>
你会注意到这包含了这个问题最广泛给出的答案,即底部的 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?
推荐答案
无法插入数据库但不是sql权限问题?
You can't insert into the database but it's not a sql permissions problem?
- 也许你的磁盘已满.
- 也许您创建了一个没有 IDENTITY 列的表,而该列应该有.
说真的——你等不及整整两分钟才得到答复?也许它正在插入数据库,但您检查得太快了.
Seriously - you couldn't wait two WHOLE MINUTES for an answer? Maybe it is inserting into the database, but you're checking too quickly.
这篇关于Elmah 1.2 不会在 Windows 2008 IIS7.5 集成模式下登录 SQL(但在本地工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!