无法添加唯一键属性“名称"设置为"aspNetCore"的类型为“添加"的重复收集条目 [英] Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'aspNetCore

查看:198
本文介绍了无法添加唯一键属性“名称"设置为"aspNetCore"的类型为“添加"的重复收集条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将我的ASP.NET Core应用程序发布到了主机上.我遇到了HTTP错误500.19.

I have recently published my ASP.NET Core application to my host. I am hitting a HTTP Error 500.19.

IIS 8.5表示问题是:-

IIS 8.5 says the issue is:-

无法添加类型为'add'的重复集合条目,且其唯一键属性'name'设置为'aspNetCore'"

它也突出显示了我的system.webServer配置中的这一关键添加行:-

It also highlights this key add line in my system.webServer config:-

<handlers>
  <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule"      
</handlers>

我不太确定该怎么做.看起来好像有一个重复的实例,所以我尝试重命名它,但它仍然要求再次添加它?

I'm not really sure what to do on this. It looks as though there is a duplicate instance of this, so I have tried renaming this but it still asks to add this again?

这是我的web.config:-

Here is my web.config:-

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <!--
  Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
  -->

  <system.webServer>
  <handlers>
    <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
  </handlers>
  <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
  </system.webServer>

<system.net>
<defaultProxy useDefaultCredentials="true" >
</defaultProxy>
</system.net>
</configuration>

推荐答案

上面的答案对我不起作用,但是DavidG的评论确实解决了我的问题,因此如果有帮助,请发布为答案.

The answer above didn't work for me, however DavidG's comment did solve my problem, so going to post as an answer in case it helps someone else.

对我来说,我不是将其作为子应用程序运行,并且一个对我来说已经超过一年没有问题的项目突然停止处理此问题.仍然不确定发生了什么变化.当我注释掉或删除了<add name="aspNetCore".../>时,错误仍然存​​在,然后自动重新添加了该行.

For me, I was not running it as a sub-application, and a project that had been working for me no issue for over a year suddenly stopped working with this issue. Still not sure what changed. When I commented out or removed the <add name="aspNetCore".../> the error persisted, and then that line got automatically re-added.

为解决该问题,我在<add name="aspNetCore"... />条目上方的配置文件中添加了<remove name="aspNetCore" />,然后一切又开始正常工作.

To solve the problem, I added <remove name="aspNetCore" /> to the config file, right above the <add name="aspNetCore"... /> entry, and things started working again.

这篇关于无法添加唯一键属性“名称"设置为"aspNetCore"的类型为“添加"的重复收集条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆