Elmah.MVC在IIS Express下工作但不是IIS 7.5

时间:2022-12-02 11:26:18

I'm trying to get Elmah working under ASP.NET MVC and I thought I had. I used the very convenient Elmah MVC project which automatically setup my web.config file. Now if I run the project under IIS Express then Elmah works just perfectly. I can access it with the correct Authorisation and the logs are stored in my SQL Database. However when I try and run it under IIS 7.5 I get an:

我试图让Elmah在ASP.NET MVC下工作,我以为我有。我使用了非常方便的Elmah MVC项目,它自动设置我的web.config文件。现在,如果我在IIS Express下运行该项目,那么Elmah就可以完美地运行。我可以使用正确的授权访问它,日志存储在我的SQL数据库中。但是,当我尝试在IIS 7.5下运行它时,我得到一个:

An HTTP 500.19 Internal Server error 
Module  IIS Web Core
Notification    BeginRequest
Handler Not yet determined
Error Code  0x800700b7
Config Error    Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ErrorLog'
Config File web.config

Config Source:
  111:     <modules>
  112:       <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
  113:     </modules>

I'm baffled as to why this might be. As a test I've created a brand new clean MVC project and it reacts exactly the same way.

我很困惑为什么会这样。作为测试,我创建了一个全新的清洁MVC项目,它的反应方式完全相同。

1 个解决方案

#1


19  

do a

做一个

<remove name="ErrorLog"/>

before the

之前

<add />

to get rid of any default defined entries named ErrorLog in the modules section of your web.config file.

删除web.config文件的modules部分中名为ErrorLog的任何默认定义条目。

#1


19  

do a

做一个

<remove name="ErrorLog"/>

before the

之前

<add />

to get rid of any default defined entries named ErrorLog in the modules section of your web.config file.

删除web.config文件的modules部分中名为ErrorLog的任何默认定义条目。