配置文件标记为重复的异常包

config file flagging as duplicate Exceptionless package

不确定我的项目发生了什么,但是当我尝试 运行 它时,我收到了错误消息 Could not load file or assembly 'Exceptionless.Mvc' or one of its dependencies

Eceptionless.MVC 在我的项目的任何地方都没有被使用或引用我什至找不到任何带有 Exceptionless 的文本......

所以我使用 Nuget Manager 安装了 exceptionless.MVC 包。

现在我收到错误

`HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Config Error
There is a duplicate 'exceptionless' section defined `

exceptionless.Mvc 的安装在我的网络配置中添加了以下内容

 <section name="exceptionless" type="Exceptionless.ExceptionlessSection, Exceptionless" />
 <exceptionless apiKey="API_KEY_HERE" />
  <modules runAllManagedModulesForAllRequests="true">
      <add name="ExceptionlessModule" type="Exceptionless.Mvc.ExceptionlessModule, Exceptionless.Mvc" />
    </modules>

并且包配置已更新

  <package id="Exceptionless" version="4.2.1982" targetFramework="net45" />

这是我项目中对 exceptionsless/exceptionlessMVC 的唯一引用。

我不知道它在 mvc exceptionless 中寻找什么,或者重复的部分在哪里??

有什么帮助吗?

您应该尝试删除处理程序,然后再将其添加回去。这是一个类似的示例:

  <system.webServer>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>

您可能也需要注释掉这部分。

 <section name="exceptionless".... 

Web.config 继承自父应用程序的 Web.config。还有机器范围的 web.config 和 machine.config.

1) 如果您的应用程序在 IIS 上并且有父应用程序,请检查父应用程序web.config

2) 检查您机器范围内的 web.config 和 machine.config。 假设您使用的是 .NET 4.0 及更高版本,它们在此处: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config (对于 x32 位应用程序池) C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config (对于 x64 位应用程序池)

问题与存储在 IIS 中的重复 Web 配置文件有关。重命名该 Web 配置允许原始配置优先删除任何重复的问题。